Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java Statistical Analysis on Student Exam Scores: A professor wants to perform some statistical analysis on his student's exam scores. You need to ask how
java
Statistical Analysis on Student Exam Scores: A professor wants to perform some statistical analysis on his student's exam scores. You need to ask how many students are in his class, what the exam grades are for each student, read these values from the console, and print the statistical analysis of the grades. Create a Java class by right clicking on the src folder New -> Class and naming it GradeStatistics. A new window will appear asking for some information. Make sure to check the box near the bottom that says public static void main(String[] args). See the image below for reference. With your new GradeStatisics.java class, you can open it by double clicking on it in the Package Explorer panel (if it did not open automatically) and begin coding. Insert the following methods into this class. public static double[] populateGrades() Use a scanner object to take in the student grades as input from the console and store it in an array of type double. The method should return the array containing the student's grades. public static void sortGrades(double grades[]) Take the grades array and sort the grades in ascending order (from low to high). You may use the Arrays.sort() method. public static double getMean(double grades[]) Calculate the mean statistic from the grades array and return it. public static double getMedian(double grades[]) Calculate the median statistic from the grades array and return it. public static double getRange(double grades[]) - Calculate the range statistic from the grades array and return it. public static double[] getMinMax(double grades[]) Find the minimum and maximum values from the grades array parameter. Then, return a new array that has the minimum and maximum values in index 0 and 1, respectively (the new array is of length 2). public static void printGrades(double grades[]) Print the array of grades in a predetermined format given below. That is, print from left (index 0) to right, with 1 decimal place and separated by a comma and a space. 99.0, 74.5, 83.1, 100.0,50.4 public static void printStatistics(double mean, double median, double range, double[] minMax) - Print the statistical analysis as calculated from the grades. That is, print a separate line for each of the four statistics. Mean = 81.4 Median = 83.1 Range = 49.6 Min = 50.4 Max = 100.0 public static void main(String args[]) The main method which will call the methods above in a specific order. Call populateGrades() to get the input array reference. Print the grades using printGrades() and the array you just saved from the previous step. Sort the grades using sortGrades(). This sorted array should be used for the remainder of the tasks. Print the sorted grades using the printGrades() method again. Compute the mean with getMean(). Compute the median with getMedian(). Compute the range with getRange(). Find the minimum and maximum values with getMinMax(). Print the calculated statistics using printStatistics(). Test Run 1: How many students do you have in the class: 3 Enter grade of Student 1: 75.3 Enter grade of Student 2: 66.8 Enter Grade of Student 3: 95.3 The grades are: 75.3,66.8,95.3 The sorted grades are: 66.8, 75.3,95.3 Mean = 79.1 Median = 75.3 Range = 28.5 Min = 66.8 Max = 95.3 Test Run 2: How many students do you have in the class: 6 Enter grade of Student 1: 75.3 Enter grade of Student 2: 66.8 Enter Grade of Student 3: 95.3 Enter Grade of Student 4: 100.0 Enter Grade of Student 5: 50.2 Enter Grade of Student 6: 78.9 The grades are: 75.3,66.8,95.3, 100.0, 50.2, 78.9 The sorted grades are: 50.2,66.8, 75.3, 78.9,95.3, 100.0 Mean = 77.8 Median = 77.1 Range = 49.8 Min = 50.2 Max = 100.0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started