SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Downloaden Sie, um offline zu lesen
//FileName: EX06_1.java
//Programmer: ............
import java.util.Scanner;
import java.util.Arrays;
public class EX06_1
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a list of SAT scores: ");
String str = input.nextLine();
String[] items = str.split(" ");
double[] values = new double[items.length];
for (int i = 0; i<items.length; i++)
{
values[i] = Double.parseDouble(items[i]);
}
//count
System.out.print("Count: ");
int count = 0;
for (int i=0; i<values.length; i++)
{
count++;
}
System.out.println((count == values.length) ? values.length : count);
//sum
double sum = 0;
for (int i = 0; i<values.length; i++)
{
sum += values[i];
}
System.out.println("Sum: " + sum);
//mean
double mean = (sum/count);
System.out.println("Mean: " + mean);
//min and max
double min = values[0];
double max = values[0];
for (int i=1; i<values.length; i++)
{
if (values[i] < min)
{
min = values[i];
}
if (values[i] > max)
{
max = values[i];
}
}
System.out.println("Minimum: " + min);
System.out.println("Maximum: " + max);
System.out.println("Range: " + (max-min));
//sorting
Arrays.sort(values);
//median
int position = (count+1) / 2;
if (count%2 != 0)
{
System.out.println("Median: " + values[position-1]);
}
else
{
System.out.println("Median: " + (( values[position-1] + values[position]) / 2));
}
//Standard deviation
double sigmap = 0; //for population
double sigmas = 0; //for sample
for (int i=0; i<values.length; i++)
{
sigmap += (values[i] - mean)*(values[i] - mean);
}
sigmas = sigmap;
//sd for population
sigmap = sigmap / count;
System.out.println("Variance of population: " + sigmap);
double sdp = Math.sqrt(sigmap);
System.out.println("Standard Deviation of population: " + sdp);
//sd for sample
sigmas = sigmas / (count - 1);
System.out.println("Variance of sample: " + sigmas);
double sds = Math.sqrt(sigmas);
System.out.println("Standard Deviation of sample: " + sds);
//Skewness
double sigma = 0;
for (int i=0; i<values.length; i++)
{
sigma += (values[i] - mean)*(values[i] - mean)*(values[i] - mean);
}
double N = (double) count;
double sk = (Math.sqrt(N*(N-1)) / (N-2)) * (sigma / (sdp*sdp*sdp*N));
System.out.println("Skewness: " + sk);
//mode
int repeated = -1;
int[] frq = new int[values.length];
for (int i=0; i<values.length; i++)
{
int occ = 1;
for (int j=i+1; j<values.length; j++)
{
if (values[i] == values[j])
{
frq[j] = repeated;
occ++;
}
}
if (frq[i] != repeated)
{
frq[i] = occ;
}
}
int maxFrq = frq[0];
for (int i=0; i<frq.length; i++)
{
if (frq[i] > maxFrq)
{
maxFrq = frq[i];
}
}
System.out.print("Mode: ");
if (maxFrq == 1)
{
System.out.println("N/A");
}
else
{
for (int i=0; i<frq.length; i++)
{
if (frq[i] == maxFrq)
{
System.out.print(values[i] + " ");
}
}
System.out.print("n");
}
double standardError=sds/Math.sqrt(count);
System.out.println("Standard Error: "+standardError);
}
}
Programming Exercise #06_2:
Instruction:
1. Make a copy of your EX06_01.java file and rename it to EX06_2.java.
2. Open the EX06_02.java file, mode the following two lines (be sure to replace YourFullName
with your full name): // FileName: EX06_2.java // Programmer: YourFullName
3. Convert the code, so it can use an input dialog box to ask for inputs and display the output in a
message dialog box as shown below

Weitere ähnliche Inhalte

Ähnlich wie FileName EX06_1java Programmer import ja.pdf

Example of JAVA Program
Example of JAVA ProgramExample of JAVA Program
Example of JAVA ProgramTrenton Asbury
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfeyewatchsystems
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...MaruMengesha
 
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 Problem1 java codeimport java.util.Scanner; Java code to pr.pdf Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
Problem1 java codeimport java.util.Scanner; Java code to pr.pdfanupamfootwear
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfarihantmum
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaanwalia Shaan
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2YOGESH SINGH
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Sunil Kumar Gunasekaran
 
import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docxKatecate1
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdfaravlitraders2012
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtractionCharm Sasi
 
ch04-conditional-execution.ppt
ch04-conditional-execution.pptch04-conditional-execution.ppt
ch04-conditional-execution.pptMahyuddin8
 
ch03-parameters-objects.ppt
ch03-parameters-objects.pptch03-parameters-objects.ppt
ch03-parameters-objects.pptMahyuddin8
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Code javascript
Code javascriptCode javascript
Code javascriptRay Ray
 

Ähnlich wie FileName EX06_1java Programmer import ja.pdf (20)

Example of JAVA Program
Example of JAVA ProgramExample of JAVA Program
Example of JAVA Program
 
PRACTICAL COMPUTING
PRACTICAL COMPUTINGPRACTICAL COMPUTING
PRACTICAL COMPUTING
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
 
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 Problem1 java codeimport java.util.Scanner; Java code to pr.pdf Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
Parameters
ParametersParameters
Parameters
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
 
import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docx
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdf
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtraction
 
ch04-conditional-execution.ppt
ch04-conditional-execution.pptch04-conditional-execution.ppt
ch04-conditional-execution.ppt
 
ch03-parameters-objects.ppt
ch03-parameters-objects.pptch03-parameters-objects.ppt
ch03-parameters-objects.ppt
 
3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Code javascript
Code javascriptCode javascript
Code javascript
 

Mehr von actocomputer

Figure 3 below shows that the survival rate of Blue Wildeb.pdf
Figure 3 below shows that the survival rate of Blue Wildeb.pdfFigure 3 below shows that the survival rate of Blue Wildeb.pdf
Figure 3 below shows that the survival rate of Blue Wildeb.pdfactocomputer
 
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdf
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdfFIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdf
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdfactocomputer
 
Fibroblast cells from patients Jack Karen Agatha and Tony.pdf
Fibroblast cells from patients Jack Karen Agatha and Tony.pdfFibroblast cells from patients Jack Karen Agatha and Tony.pdf
Fibroblast cells from patients Jack Karen Agatha and Tony.pdfactocomputer
 
Fetal pig What is the purpose of the pericardial sac that su.pdf
Fetal pig What is the purpose of the pericardial sac that su.pdfFetal pig What is the purpose of the pericardial sac that su.pdf
Fetal pig What is the purpose of the pericardial sac that su.pdfactocomputer
 
Find the probability PEc if PE019 The probability PE.pdf
Find the probability PEc if PE019 The probability PE.pdfFind the probability PEc if PE019 The probability PE.pdf
Find the probability PEc if PE019 The probability PE.pdfactocomputer
 
Feral pigs are an invasive species around the world They ca.pdf
Feral pigs are an invasive species around the world They ca.pdfFeral pigs are an invasive species around the world They ca.pdf
Feral pigs are an invasive species around the world They ca.pdfactocomputer
 
Find the maximum likelihood estimator of +2 Suppose that .pdf
Find the maximum likelihood estimator of +2 Suppose that .pdfFind the maximum likelihood estimator of +2 Suppose that .pdf
Find the maximum likelihood estimator of +2 Suppose that .pdfactocomputer
 
Find the indicated IQ score The graph to the right depicts .pdf
Find the indicated IQ score The graph to the right depicts .pdfFind the indicated IQ score The graph to the right depicts .pdf
Find the indicated IQ score The graph to the right depicts .pdfactocomputer
 
Female labour force participation rate and economic growth i.pdf
Female labour force participation rate and economic growth i.pdfFemale labour force participation rate and economic growth i.pdf
Female labour force participation rate and economic growth i.pdfactocomputer
 
FedEx construy su negocio sobre la base de la entrega rpid.pdf
FedEx construy su negocio sobre la base de la entrega rpid.pdfFedEx construy su negocio sobre la base de la entrega rpid.pdf
FedEx construy su negocio sobre la base de la entrega rpid.pdfactocomputer
 
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdf
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdffecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdf
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdfactocomputer
 
Find the area of the shaded region The graph to the right de.pdf
Find the area of the shaded region The graph to the right de.pdfFind the area of the shaded region The graph to the right de.pdf
Find the area of the shaded region The graph to the right de.pdfactocomputer
 
Find code that you wrote and apply 2 of the 3 design princip.pdf
Find code that you wrote and apply 2 of the 3 design princip.pdfFind code that you wrote and apply 2 of the 3 design princip.pdf
Find code that you wrote and apply 2 of the 3 design princip.pdfactocomputer
 
Find a current news article or video within the past 12 mon.pdf
Find a current news article or video within the past 12 mon.pdfFind a current news article or video within the past 12 mon.pdf
Find a current news article or video within the past 12 mon.pdfactocomputer
 
Female pig Emmy Lou straight tail whitehaired with the h.pdf
Female pig Emmy Lou straight tail whitehaired with the h.pdfFemale pig Emmy Lou straight tail whitehaired with the h.pdf
Female pig Emmy Lou straight tail whitehaired with the h.pdfactocomputer
 
Financing Assumptions Please assume a traditional bank cons.pdf
Financing Assumptions Please assume a traditional bank cons.pdfFinancing Assumptions Please assume a traditional bank cons.pdf
Financing Assumptions Please assume a traditional bank cons.pdfactocomputer
 
FigURE 01 Needle intersecting the border of the ruled tabl.pdf
FigURE 01 Needle intersecting the border of the ruled tabl.pdfFigURE 01 Needle intersecting the border of the ruled tabl.pdf
FigURE 01 Needle intersecting the border of the ruled tabl.pdfactocomputer
 
Financial InformationFinancial InformationFinancial In.pdf
Financial InformationFinancial InformationFinancial In.pdfFinancial InformationFinancial InformationFinancial In.pdf
Financial InformationFinancial InformationFinancial In.pdfactocomputer
 
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdf
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdfFewer open fNa+ and Ca++ channels during the pacemaker poten.pdf
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdfactocomputer
 
FIN 3100 Principios de Finanzas Caso de estudio Barry y S.pdf
FIN 3100 Principios de Finanzas   Caso de estudio  Barry y S.pdfFIN 3100 Principios de Finanzas   Caso de estudio  Barry y S.pdf
FIN 3100 Principios de Finanzas Caso de estudio Barry y S.pdfactocomputer
 

Mehr von actocomputer (20)

Figure 3 below shows that the survival rate of Blue Wildeb.pdf
Figure 3 below shows that the survival rate of Blue Wildeb.pdfFigure 3 below shows that the survival rate of Blue Wildeb.pdf
Figure 3 below shows that the survival rate of Blue Wildeb.pdf
 
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdf
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdfFIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdf
FIGURE 241 Refer to Figure 241 Suppose the economy is cur.pdf
 
Fibroblast cells from patients Jack Karen Agatha and Tony.pdf
Fibroblast cells from patients Jack Karen Agatha and Tony.pdfFibroblast cells from patients Jack Karen Agatha and Tony.pdf
Fibroblast cells from patients Jack Karen Agatha and Tony.pdf
 
Fetal pig What is the purpose of the pericardial sac that su.pdf
Fetal pig What is the purpose of the pericardial sac that su.pdfFetal pig What is the purpose of the pericardial sac that su.pdf
Fetal pig What is the purpose of the pericardial sac that su.pdf
 
Find the probability PEc if PE019 The probability PE.pdf
Find the probability PEc if PE019 The probability PE.pdfFind the probability PEc if PE019 The probability PE.pdf
Find the probability PEc if PE019 The probability PE.pdf
 
Feral pigs are an invasive species around the world They ca.pdf
Feral pigs are an invasive species around the world They ca.pdfFeral pigs are an invasive species around the world They ca.pdf
Feral pigs are an invasive species around the world They ca.pdf
 
Find the maximum likelihood estimator of +2 Suppose that .pdf
Find the maximum likelihood estimator of +2 Suppose that .pdfFind the maximum likelihood estimator of +2 Suppose that .pdf
Find the maximum likelihood estimator of +2 Suppose that .pdf
 
Find the indicated IQ score The graph to the right depicts .pdf
Find the indicated IQ score The graph to the right depicts .pdfFind the indicated IQ score The graph to the right depicts .pdf
Find the indicated IQ score The graph to the right depicts .pdf
 
Female labour force participation rate and economic growth i.pdf
Female labour force participation rate and economic growth i.pdfFemale labour force participation rate and economic growth i.pdf
Female labour force participation rate and economic growth i.pdf
 
FedEx construy su negocio sobre la base de la entrega rpid.pdf
FedEx construy su negocio sobre la base de la entrega rpid.pdfFedEx construy su negocio sobre la base de la entrega rpid.pdf
FedEx construy su negocio sobre la base de la entrega rpid.pdf
 
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdf
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdffecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdf
fecower Kayimood Dwicyo Soens sherwood Compact dise playe.pdf
 
Find the area of the shaded region The graph to the right de.pdf
Find the area of the shaded region The graph to the right de.pdfFind the area of the shaded region The graph to the right de.pdf
Find the area of the shaded region The graph to the right de.pdf
 
Find code that you wrote and apply 2 of the 3 design princip.pdf
Find code that you wrote and apply 2 of the 3 design princip.pdfFind code that you wrote and apply 2 of the 3 design princip.pdf
Find code that you wrote and apply 2 of the 3 design princip.pdf
 
Find a current news article or video within the past 12 mon.pdf
Find a current news article or video within the past 12 mon.pdfFind a current news article or video within the past 12 mon.pdf
Find a current news article or video within the past 12 mon.pdf
 
Female pig Emmy Lou straight tail whitehaired with the h.pdf
Female pig Emmy Lou straight tail whitehaired with the h.pdfFemale pig Emmy Lou straight tail whitehaired with the h.pdf
Female pig Emmy Lou straight tail whitehaired with the h.pdf
 
Financing Assumptions Please assume a traditional bank cons.pdf
Financing Assumptions Please assume a traditional bank cons.pdfFinancing Assumptions Please assume a traditional bank cons.pdf
Financing Assumptions Please assume a traditional bank cons.pdf
 
FigURE 01 Needle intersecting the border of the ruled tabl.pdf
FigURE 01 Needle intersecting the border of the ruled tabl.pdfFigURE 01 Needle intersecting the border of the ruled tabl.pdf
FigURE 01 Needle intersecting the border of the ruled tabl.pdf
 
Financial InformationFinancial InformationFinancial In.pdf
Financial InformationFinancial InformationFinancial In.pdfFinancial InformationFinancial InformationFinancial In.pdf
Financial InformationFinancial InformationFinancial In.pdf
 
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdf
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdfFewer open fNa+ and Ca++ channels during the pacemaker poten.pdf
Fewer open fNa+ and Ca++ channels during the pacemaker poten.pdf
 
FIN 3100 Principios de Finanzas Caso de estudio Barry y S.pdf
FIN 3100 Principios de Finanzas   Caso de estudio  Barry y S.pdfFIN 3100 Principios de Finanzas   Caso de estudio  Barry y S.pdf
FIN 3100 Principios de Finanzas Caso de estudio Barry y S.pdf
 

Kürzlich hochgeladen

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Kürzlich hochgeladen (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

FileName EX06_1java Programmer import ja.pdf

  • 1. //FileName: EX06_1.java //Programmer: ............ import java.util.Scanner; import java.util.Arrays; public class EX06_1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a list of SAT scores: "); String str = input.nextLine(); String[] items = str.split(" "); double[] values = new double[items.length]; for (int i = 0; i<items.length; i++) { values[i] = Double.parseDouble(items[i]); } //count System.out.print("Count: "); int count = 0; for (int i=0; i<values.length; i++) { count++; } System.out.println((count == values.length) ? values.length : count); //sum double sum = 0; for (int i = 0; i<values.length; i++) { sum += values[i]; } System.out.println("Sum: " + sum); //mean double mean = (sum/count); System.out.println("Mean: " + mean); //min and max double min = values[0]; double max = values[0]; for (int i=1; i<values.length; i++) { if (values[i] < min) {
  • 2. min = values[i]; } if (values[i] > max) { max = values[i]; } } System.out.println("Minimum: " + min); System.out.println("Maximum: " + max); System.out.println("Range: " + (max-min)); //sorting Arrays.sort(values); //median int position = (count+1) / 2; if (count%2 != 0) { System.out.println("Median: " + values[position-1]); } else { System.out.println("Median: " + (( values[position-1] + values[position]) / 2)); } //Standard deviation double sigmap = 0; //for population double sigmas = 0; //for sample for (int i=0; i<values.length; i++) { sigmap += (values[i] - mean)*(values[i] - mean); } sigmas = sigmap; //sd for population sigmap = sigmap / count; System.out.println("Variance of population: " + sigmap); double sdp = Math.sqrt(sigmap); System.out.println("Standard Deviation of population: " + sdp); //sd for sample sigmas = sigmas / (count - 1); System.out.println("Variance of sample: " + sigmas); double sds = Math.sqrt(sigmas); System.out.println("Standard Deviation of sample: " + sds); //Skewness double sigma = 0;
  • 3. for (int i=0; i<values.length; i++) { sigma += (values[i] - mean)*(values[i] - mean)*(values[i] - mean); } double N = (double) count; double sk = (Math.sqrt(N*(N-1)) / (N-2)) * (sigma / (sdp*sdp*sdp*N)); System.out.println("Skewness: " + sk); //mode int repeated = -1; int[] frq = new int[values.length]; for (int i=0; i<values.length; i++) { int occ = 1; for (int j=i+1; j<values.length; j++) { if (values[i] == values[j]) { frq[j] = repeated; occ++; } } if (frq[i] != repeated) { frq[i] = occ; } } int maxFrq = frq[0]; for (int i=0; i<frq.length; i++) { if (frq[i] > maxFrq) { maxFrq = frq[i]; } } System.out.print("Mode: "); if (maxFrq == 1) { System.out.println("N/A"); } else { for (int i=0; i<frq.length; i++)
  • 4. { if (frq[i] == maxFrq) { System.out.print(values[i] + " "); } } System.out.print("n"); } double standardError=sds/Math.sqrt(count); System.out.println("Standard Error: "+standardError); } } Programming Exercise #06_2: Instruction: 1. Make a copy of your EX06_01.java file and rename it to EX06_2.java. 2. Open the EX06_02.java file, mode the following two lines (be sure to replace YourFullName with your full name): // FileName: EX06_2.java // Programmer: YourFullName 3. Convert the code, so it can use an input dialog box to ask for inputs and display the output in a message dialog box as shown below