Question: in JAVA , you will create a classroom grading management application. This program will utilize a menu system. Start off by creating 2 arrays and
in JAVA, you will create a classroom grading management application. This program will utilize a menu system.
Start off by creating 2 arrays and populate them with data. The arrays will be declared as follows
1. students String[] Array that will hold 5 student names. Populate it with 5 student names of your choice.
2. grades int[] Array that will hold 5 grades. Populate it with 5 grades (int as variable data type) of your choice.
(**Both arrays have corresponding elements. Meaning, the first student of the students array matches the first grade of the grades array.** )
- When the program runs, present the user with a menu. The menu will keep appearing until the user chooses to quit. The menu will have the following 4 options for the user
(v)iew all student grades -- This will display a JOptionPane with the names of ALL the students and the students grade for the course. A loop must be used for this.
(a)verage all grades -- This will display a JOptionPane with the average of all the grades in the class. A loop must be used for this calculation.
(e)nter new grade for student -- Ask the user for the index position of the grade they wish to change. Then obtain a new grade and change the value of the index position that the user has specified.
(q)uit program -- Quit the program.
IMPORTANT
The menu must be created using a separate method from the main. You will be calling this method twice within your main. You will not have to pass the arrays to the method as the menu does not need any of the data from the array. You will lose points if you pass the arrays as arguments.
please import javax.swing.*; for your JOptionPanes.
THERE WILL BE NO USE OF CONSOLE LOGGING OR IMPORTED SCANNER. EVERYTHING MUST BE DONE USING JOptionPanes.
below is the starting code.....
import javax.swing.*;
public class project2 {
public static void main(String[] args) { String[] students = {"Bob", "Joe", "Paul", "Amanda", "Chris"}; int[] grades = {98, 76, 88, 65, 92}; String menuchoice = showMenu();
}// end main //show Menu Method first public static String showMenu() { String msg = "Please select a menu option "; msg += "(v)iew all students grades "; msg += "(a)verage of all grades "; msg += "(e)nter new grade for student "; msg += "(q)uit program "; return JOptionPane.showInputDialog(null, msg); }//ends showMenu
}// end class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
