Hello i have an other code that bother me because i am confused what i should do take a llok to the questions first:
**Example 2: The GradeBook Class:
Consider the attached GradeBook class. Complete the following tasks:
1-Modify the determineClassAverage method so it allows the user to enter the number of grades (i.e., the method no longer assumes 5 grades; this number needs to be determined by the user). Also this method needs to calculate and display the maximum grade.
2-Create a tester class named UseGradebook with a menu for the different items, and implement the menu items. Here’s a sample menu:
Choose from the following option:
1- Create the default Java GradeBook
2- Creat a new GradeBook
3- Dosplay the welcoming Message
4- Caluclate the class avarege and the Maxumim grade
5- quit
Enter your choise: **
That's the questions i tryed to start with JToption but i couldn't complete it and i know i should have the JOptionPane to do the menu or what!!??
Look to what i am doing i now i am not in the write trace but cold someone tell me from where i can start or what should i do
import java.util.*;
import javax.swing.*;
public class GradeBook {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(" Enter the number of Students: ");
int numberOfScore = in.nextInt();
int[] scores = new int[5];
System.out.print(" Enter " + numberOfScore + " scores: ") ;
scores[0] = in.nextInt();
scores[1] = in.nextInt();
scores[2] = in.nextInt();
scores[3] = in.nextInt();
scores[4] = in.nextInt();
displayGrades(scores);
}
public static void displayGrades(int[] grades){
int highScore = bestGrade(grades);
for (int i = 0; i < grades.length; i++){
System.out.printf(" Student %d scor is %d and grade is %s%n", i, grades[i], assignLetterGrade(grades[i], highScore));
}
}
private static Object assignLetterGrade(int grades, int highScore) {
if (highScore - grades <= 10)
return "A";
return null;
}
private static int bestGrade(int[] grades) {
// TODO Auto-generated method stub
return 0;
}
}