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

Create within java. Include a program that tests the ExamResults class. Create a

ID: 653893 • Letter: C

Question

Create within java.

Include a program that tests the ExamResults class.

Create an ExamResults class that has four instance methods: record, average, max, min, and count, record enters a grade (an integer between 0 and 100). average, max, min, and count report on the grades entered so far. average, min, and count return the average, minimum, and maximum grades, respectively. count returns the number of grades entered. record should perform an integrity check on the grade it is passed (it should check that the grade is between 0 and 100). Write a program to test your class. Assume grades are integers. However, average should return the average grade as a double value.

Explanation / Answer

import javax.swing.JOptionPane;
public class ExamAnalysis
     {
     public static void main( String args[] )
         {
         // initializing variables in declarations
         int passes = 0, // number of passes
         failures = 0, // number of failures
         student = 1, // student counter
         result; // one exam result
         String input, // user-entered value
         output; // output string
      
         // process 10 students; counter-controlled loop
         while ( student <= 10 )
             {
             input = JOptionPane.showInputDialog( "Enter result (1=pass,2=fail)" );
             result = Integer.parseInt( input );
          
             if ( result == 1 )
             passes = passes + 1;
             else
             failures = failures + 1;
          
             student = student + 1;
         }
      
         // termination phase
         output = "Passed: " + passes + " Failed: " + failures;
         if( passes > 8 )
         output = output + " Raise Tuition";
      
         JOptionPane.showMessageDialog( null, output, "Analysis of Examination Results", JOptionPane.INFORMATION_MESSAGE );
      
         System.exit( 0 );
     }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote