Question

In: Computer Science

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

Solutions

Expert Solution

Code Screenshot :

Executable Code:

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

public class Main
{
   public static void main(String[] args)
   {
       //Declaring required variables
       int n;
       double sum = 0;
       Scanner s = new Scanner(System.in);
       //Declaring an array
       int a[] = new int[7];
       //Prompting the user for input
       System.out.println("Enter all the grades:");
       //Reading array values
       for(int i = 0; i < 7; i++)
       {
           a[i] = s.nextInt();
       }
       //Sorting the array
       Arrays.sort(a);
       //Printing the array after sorting
       System.out.println("Array after sorting : "+Arrays.toString(a));
       //Calculating the sum
       for(int i = 1; i < 7; i++)
       {
           sum+=a[i];
       }
       //Printing the average after dropping lowest grade
       System.out.println("Average :"+sum/6);
   }
}

Sample Output :

Please comment below if you have any queries.
Please do give a thumbs up if you liked the answer thanks :)


Related Solutions

(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.
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.
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.
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,...
UML Diagram for this java code //java code import java.util.*; class Message { private String sentence;...
UML Diagram for this java code //java code import java.util.*; class Message { private String sentence; Message() { sentence=""; } Message(String text) { setSentence(text); } void setSentence(String text) { sentence=text; } String getSentence() { return sentence; } int getVowels() { int count=0; for(int i=0;i<sentence.length();i++) { char ch=sentence.charAt(i); if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' || ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U') { count=count+1; } } return count; } int getConsonants() { int count=0; for(int i=0;i<sentence.length();i++)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT