Question

In: Computer Science

(JAVA) A class allows students to drop their lowest of 7 quiz grades at the end...

(JAVA) A class allows students to drop their lowest of 7 quiz grades at the end of the semester. Prompt the user for these values and add them to an array of integer type. Sort the array using the sort method from the standard Java library. Output the student’s average with the lowest score dropped.

Solutions

Expert Solution

import java.util.Arrays;
import java.util.Scanner;

public class AverageDrop {
        public static void main(String[] args) {
                //creating array to hold 7 scores
                int []scores = new int[7];
                Scanner sc = new Scanner(System.in);
                //reading 7 scores from user
                System.out.println("Enter 7 scores: ");
                for(int i=0;i<scores.length;i++) {
                        scores[i]=sc.nextInt();
                }
                //sorting the scores array using Java library sort()
                Arrays.sort(scores);
                double total=0;
                //finding the total by droping the lowest score which is at index =0
                for(int i=1;i<scores.length;i++)
                        total+=scores[i];
                //finding the average with 6 as we droped lowest score
                double average = total /6;
                System.out.printf("Average: %.2f",average);
        }
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

Please Like and Support me as it helps me a lot


Related Solutions

Code in java, A class allows students to drop their lowest of 7 quiz grades at...
Code in java, A class allows students to drop their lowest of 7 quiz grades at the end of the semester. Prompt the user for these values and add them to an array of integer type. Sort the array using the sort method from the standard Java library. Output the student’s average with the lowest score dropped
There are 25 students in a class. The lowest quiz score is a 5. The average...
There are 25 students in a class. The lowest quiz score is a 5. The average quiz score is 14, median is 15, and SD is 3. If the student who got a 5 has their grade changed to a 10, what happens to the average, the median, and the SD, respectively? Answer in detail.
Write a java code snippet that allows a teacher to track her students’ grades. Use a...
Write a java code snippet that allows a teacher to track her students’ grades. Use a loop to prompt the user for each student’s name and the grade they received. Add these values to two separate parallel ArrayLists. Use a sentinel to stop. Output a table listing each of the student’s names in one column and their associated grades in the second column.
Create an Java application that uses a class to convert number grades to letter grades and...
Create an Java application that uses a class to convert number grades to letter grades and another class for data validation. Specifications The Grade class should have only one Instance Variable of type int. Use a class named Grade to store the data for each grade. This class should include these three methods:   public void setNumber(int number)   public int getNumber()   public String getLetter() The Grade class should have two constructors. The first one should accept no parameters and set the...
In a class of 25 students the average grade on a quiz is 16.85, with a...
In a class of 25 students the average grade on a quiz is 16.85, with a sample standard deviation of 4.75. The grades are known to be normally distributed. a. Determine the standard error of the mean. b. Determine the 98% confidence interval for the class grades. c. If you wanted a narrower interval, would you increase or decrease the confidence level?
10. The grades of students are normal distributed. In a class of 10 students the average...
10. The grades of students are normal distributed. In a class of 10 students the average grade on a quiz is 16.35, with a standard deviation of 4.15. ( 3 marks ) a) Find the 90% confidence interval for the population mean grade. b) If you wanted a wider confidence interval, would you increase or decrease the confidence level?
The grades of a class of 9 students on a midterm report (x) and on the...
The grades of a class of 9 students on a midterm report (x) and on the final examination (y) are as follows:    x 77 50 71 72 81 94 96 99 67 y 82 66 78 34 47 85 99 99 68 Compute a 95% confidence interval for the mean response mu subscript Y divided by x end subscript when x equals 85.
In java Q2. Write a program that reads grades of type double of eight students that...
In java Q2. Write a program that reads grades of type double of eight students that the user provides. The grades lie between 0 and 10. These grades should be written to a binary file and read from it. The program outputs the highest and lowest grades achieved by students on the screen. The file contains nothing but numbers of type double written to the file with writeDouble.
Suppose that a lecturer gives a 10-point quiz to a class of five students. The results...
Suppose that a lecturer gives a 10-point quiz to a class of five students. The results of the quiz are 3, 1, 5, 9, and 7. For simplicity, assume that the five students are the population. Assume that all samples of size 2 are taken with replacement and the mean of each sample is found. Questions: Calculate the population mean and standard deviation Suppose that you obtain at least 20 random samples of size 2. From data obtained by you,...
On a statistics test for a class of 40 students, the grades were normally distributed.The mean...
On a statistics test for a class of 40 students, the grades were normally distributed.The mean grade was 74, and the standard deviation was 8. 2. Janis scored 76 on this test. A. What was her z-score for this grade b. What percent of the class scored lower than Janis? c. Approximately how many students in the class scored lower than Janis? 3. The minumum passing grade on this test was 70. Approximately how many students scored lower than 70...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT