Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help writing this program in JAVA, this is an introductory java course, s

ID: 3811765 • Letter: I

Question

I need help writing this program in JAVA, this is an introductory java course, so if possible, keep it as basic/simple as possible while still following the instructions. The output should look like the sample execution at the end of the problem.

Write a program which takes the grades from ten quizzes and computes the average quiz score. However, the teacher usually drops the lowest two scores. You must take this into consideration when computing the average quiz grade.

Your program must implement the following methods:

readQuizScore: This method asks and reads one quiz score from the console, validates the score, and then returns the score. This method will be called once for each score.

computeAverage: This method takes the ten scores as input, computes the average, and returns the average.

getLowestScore: This method takes the ten scores as input and returns the lowest score of the tens cores.

getSecondLowestScore: This method takes the ten scores as input, and returns the second lowest score of the ten scores.

Display the two lowest scores, and the correct average.

Input Validation:

Each score must be a positive value between 0.0 and 100.0.

Requirements:

All four of the required methods must be implemented, and all must be correctly used within your program to get credit.

Round the solution to two decimal places.

Sample Execution:

Explanation / Answer

import java.util.Scanner;


public class Quiz {
  
   static float score[]= new float[10];//to store 10 scores
  
   //reading frmo the user the scores
   public static float readQuizScore(){
       Scanner scan = new Scanner(System.in);
      
       Float scoreVal = Float.parseFloat(scan.nextLine());  
       //scan.close();
       if(validateScore(scoreVal))
           return scoreVal;
       else
           return 0;
   }

   //validate methods to validate score
   private static boolean validateScore(float value) {
       if(value>=0 && value <=100)
           return true;
       else
           return false;
   }
  
   //compute Average , removes the last and last second scores
   public static float computeAverage(){
       float sum=0;
       for(int i=0; i<10;i++){
           sum=sum+score[i];
       }
      
       return (sum-getLowestScore()-getSecondLowestScore())/8;
   }
  
   //get lowest score
   public static float getLowestScore(){
       float lowestScore=score[0];
       for(int i=1; i<10;i++){
           if(score[i]<lowestScore){
               lowestScore=score[i];
           }
       }
       return lowestScore;
   }
  
   //get second lowest score
   public static float getSecondLowestScore(){
       float smallest=getLowestScore();
       float secondLowestScore=score[0];
       for(int i=0;i<10;i++)
       {
       if(score[i]<secondLowestScore && score[i]!=smallest)
       {
           secondLowestScore=score[i];
       }
       }
       return secondLowestScore;
   }
  
  

   /**
   * @param args
   */
   //driver main program
   public static void main(String[] args) {
       System.out.print("Enter the ten scores: ");
       for(int i=0;i<10;i++){
           score[i]=readQuizScore();
       }
      
       System.out.print("Two Lowest Scores: "+getLowestScore()+" and "+getSecondLowestScore()+" ");
       System.out.print("Average: "+String.format("%.2f", computeAverage()));
   }

}

-----output---------

Enter the ten scores: 100.0
78.45
89.23
98.00
67.87
88.29
82.67
87.50
90.56
94.38
Two Lowest Scores: 67.87 and 78.45
Average: 91.33

----output-------

Note: feel free to ask any doubts/question. God bless you!