Question: 1. Write the class Student which includes: (12 marks) a) 3 attributes: Student ID (which is unique), name, and GPA. b) a zero-arg constructor and

 1. Write the class Student which includes: (12 marks) a) 3
attributes: Student ID (which is unique), name, and GPA. b) a zero-arg
constructor and a mutli-arg constructor. c) getter and setter for GPA attribute.

1. Write the class Student which includes: (12 marks) a) 3 attributes: Student ID (which is unique), name, and GPA. b) a zero-arg constructor and a mutli-arg constructor. c) getter and setter for GPA attribute. d) toString() method which overrides the Object's toString() method. e) equals() method which overrides the object's equals() method. 2. Write the class Section which includes: (23 marks) a) 2 attributes: Section number and ArrayList of Students. b) one-arg constructor that accepts (as an argument) the Section number, and create a new empty ArrayList of Students. c) method addStudent that accepts a Student and add it to the ArrayList with a confirmation message. It is not allowed to add the same Student twice and in this case an error message should be displayed. d) method averageGPA which returns the average GPA of regular Students (whose GPA >= 2). It returns O if there are no regular students in the section. e) method saveIntoFile() which accepts a file name. It stores the section number and information of all Students in this file (each Student in a different line). 3. Write a code to test your classes by performing the following tasks: (5 marks) a) create a Section object called mysection where the section number is 101. b) create 2 Students and add them to mySection using the method addStudent) c) print the average GPA of regular Students by calling the method averageGPAO) d) call the method savelntoFile() to save the required information

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!