Question: Stuck on a JAVA program. I am working on a Java project and have most of the program built but missing many calculations and looking
Stuck on a JAVA program. I am working on a Java project and have most of the program built but missing many calculations and looking for some help. Thank you so much for any help!!!
Create a project that simulates a grade book for a class. Use a 2D array of integers, one row for each student, one column for each test score for that student. Set up the program for any number of students and any number of tests and ask the user for those numbers. Test the program with 3 students that each have 3 test scores.
The CourseGrades application should use a GradeBook class that has instance variables for the number of students and the number of grades, and the 2D array to contain those values. The constructor will use parameters for the number of students and the number of tests to instantiate the 2D array of the proper size. Use these methods: getGrades() to prompt the user for the test grades for each student showGrades() to display the grades for the class studentAvg() to display the average of the test scores for a specific student testAvg() to display the average of the scores for all students for a specific test
Each of those methods does its own work to request the user input about specific data and for printing to the screen.
The driver class asks the user for the number of students and number of tests and passes that to the constructor to create the gradebook. The driver class needs to ask the user for the next action show all grades, show the average for a specific student, show the average for a specific test, or exit the program. This needs to loop so the user can continue to interact with the program as often as they wish. Be sure to validate the input.
Remember that arrays begin in position 0. Be sure to compensate so that when displaying information about the first student or test, you display 1, not 0.
HERE IS MY GRADEBOOK CLASS;
public class GradeBook {
private int numberOfStudents; private int numberOfGrades; private int [][] contain; // 2D array to contain values of numberOfStudents, numberOfGrades //**************************************************************************
// constructor will use parameters for the number of students and the /umber of tests to instantiate the 2D array of the proper size public GradeBook(int students, int grades, int contain) { numberOfStudents = students; // initializes numberOfStudents numberOfGrades = grades; //initializes numberOfGrades contain = new int[]; } // end constructor
//************************************************************************** // method to get the grade to prompt the user for the test grades for each student public int getGrade(int grade) { return grade; // returns the grade } // end method getGrade
// method to display the grades for the class public void showGrades() {
} // end method showGrades
//method to display the average of the test scores for a specific student public void studentAverage(int average) { } // end method studentAverage
//method to display the average of the scores for all students for a specific test public void testAvg() {
} // end method testAvg
//************************************************************************** }//end class GradeBook
HERE IS MY MAINDRIVER;
import java.util.*;
public class GradeBookDriver {
/** * @param args the command line arguments */ public static void main(String[] args) {
//initiliaze scanner Scanner stdIn = new Scanner(System.in);
GradeBook gradeBook = new GradeBook(int numberOfStudents, int numberOfGrades); //ask the user for the number of students and number of tests //and passes that to the constructor to create the gradebook System.out.print("How many students in the class?"); System.out.print("How many tests in the course? "); } // end main } // end class GradeBookTest
HERE IS WHAT THE OUTPUT WOULD LOOK LIKE;

How many students in the class? 3 How many tests in the course? 3 Enter 1's score on test 1: 74 Enter 1's score on test 2: 84 Enter 1's score on test 3: 95 Enter 2's score on test 1: 75 Enter 's score on test 2: 85 Enter 2's score on test 3: 95 Enter 3's score n test 1: 76 Enter 3's score on test 2:86 Enter 3's score on test 3: 94 1's scores: Test 1: 74 Test 2:84 Test 3: 95 2's scores: Test 1: 75 Test 2: 85 Test 3: 95 3's scores: Test 1: 76 Test 2: 86 Test 3:94 Enter 1 (show all grades), 2 (a student's average), 3 (a test average), or 4 (quit) Enter your selection: 7 Invalid input Enter 1 (show all grades), 2 (a student's average), 3 (a test average), or 4 (quit) Enter your selection: 2 Which student's average do you want to see?1 The average score for student 1 is 84.33333333333333 Enter 1 (show all grades) 2 (a student's average), 3 (a test average), o 4 (quit) Enter your selection: 3 Which test average do you want to see? 3 The average score for test 3 is 94.66666666666667 Enter 1 (show all grades), 2 (a student's average), 3 (a test average), or 4 (quit) Enter your selection: 4 BUILD SUCCESSEUL (tota1 time: 1 minute 1 second)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
