Exercise I: Student Records
Develop a Java program that saves 3 student records using an array of objects. Each record contains the student's name, age, and GPA. In the main class, use arrays of objects, methods, and a for loop to print the student records and set both the age and GPA. Use 2 interfaces (Printable, Changeable) that have all the necessary methods as abstract. The following is the detailed hierarchy content:
Changeable interface:
Methods:
- Method to update the age of a certain student object array
- Method to update the GPA of a certain student object array
Printable interface:
Method:
- Method that prints the array of objects containing the student records
Student class:
Attributes:
- 3 arrays of objects of type Object class (each holding the student's name, age, and GPA)
Methods:
- Interfaces' methods fully implemented
- Main method to test the program
Test Scenario:
1. Print all 3 students
2. Change the age and GPA of a student, then reprint it
Hierarchy:
Printable Interface
Changeable Interface
Class (3 arrays, 3 methods)