Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve this in java and write the comments also, and please solve all the points. Time left 1:51:58 Question 1: [40 marks) 1. Write

Please solve this in java and write the comments also, and please solve all the points.

image text in transcribedimage text in transcribedimage text in transcribed

Time left 1:51:58 Question 1: [40 marks) 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. | A B 1 iii III U S X2 x2 Tole HI Q I IM **** 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 averageGPAO) 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 savelntoFile() which accepts a file name. It stores the section number and information of all Students in this file (each Student in a different line). A- B I = Po SS U X2 x2 Ho lil I *** leill10 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. A- B 1 E B U s X2 x2 ll 1 c t >

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

9. Acquire group actions history data.

Answered: 1 week ago