Java Objects Assignment
Java Objects Assignment
**Objective**:
In this assignment, you will practice creating objects with variables and methods,
as well as implementing a repeating menu system where the user can interact with
the program. You will also use 2D arrays to store information related to the
objects. The task will challenge your ability to work with objects, user input, and
array structures in Java.
**Instructions**:
1. **Create a Class**:
- Define a class called `Student`.
- The class should have the following variables:
- `String name`
- `int age`
- `String grade`
- A 2D array `int[][] scores` to store exam scores for different subjects (3
subjects and 4 exams per subject).
- The class should have:
- A constructor to initialize the `name`, `age`, `grade`, and the `scores`
array.
- Methods to:
- `void displayDetails()` to print the student’s details (name, age, and
grade).
- `void displayScores()` to print the scores in the 2D array.
- `double calculateAverage()` to return the average score of the student.
- `void updateScore(int subjectIndex, int examIndex, int newScore)` to
update a specific exam score for a subject.
2. **Menu System**:
- In your `main` method, create a program with a repeating menu system where the
user can:
1. Create a new `Student` object by inputting the student’s name, age, and
grade. The user will also input the scores for each subject (3 subjects) and 4
exams per subject.
2. Display the student’s details and their exam scores.
3. Update a specific exam score for a subject.
4. Calculate and display the average exam score.
5. Exit the program.
3. **Menu Flow**:
- Use a `while` loop to keep showing the menu until the user selects the exit
option.
- Example Menu:
```
1. Create New Student
2. Display Student Details and Scores
3. Update Exam Score
4. Calculate and Display Average Score
5. Exit
```
4. **Requirements**:
- Use a 2D array to store the student’s exam scores.
- Use methods to perform operations on the student object and array.
- Ensure proper user input validation (e.g., check for valid exam and subject
indices).
**Bonus**:
- Add a feature where multiple student objects can be created and managed in an
array of `Student` objects.