Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please implement a CLASS encapsulating the concept of students. Please reference Chapter 7. Each student must have the following 5 attributes (i.e., instance variables): a)

image text in transcribed

Please implement a CLASS encapsulating the concept of students. Please reference Chapter 7. Each student must have the following 5 attributes (i.e., instance variables): a) private String studentID;//student's ID such as 1 b) private String lastName;//student's last name such as Doe c) private String firstName;//student's first name such as John d) private double gpa;//student's GPA such as 3.00 e) private String phoneNumber;//student's phone number such as 111-5428 Please declare the following 3 static variables with proper initial values: private static int countStudents = 0;//count the total number of students being constructed private static double totalGpa = 0.0;//total GPA sum of all students//don't use float private static double averageGpa = 0.0;//average GPA of all students//don't use float Please create one constructor, 5 accessors, and 5 mutators for this Student class. The constructor must do all the following properly: a) create a new student by assigning attributes with all the data arguments being passed b) countStudents++;//increment the student count by one c) update the current GPA total and average properly as follows: totalGpa += gpa; averageGpa = totalGpa/countStudents; d) call printStudentRecord to print the complete record for this new student Please also create the following 2 static methods: (a) toString - to form a student record properly for printing; (b) printStudentRecord - to print the student record in a nice format using toString method. Therefore, at least 13 methods are to be created by you. You may make some methods static for your convenience. Please write a loop asking the user to enter student id, last name, first name, GPA, and phone number. Then, you print the student record, and show the current student count, total GPA, and average GPA. Then, continue asking the user to enter next student's data. If the student id is zero, thank the user and stop your program nicely. You must test your program (as follows) in your static void main method. Another optional way (if you know how) is to write a client class to test your program accordingly. Your testing input and output should be as follows: Please enter student id, last name, first name, GPA, and phone number> 1 Doe John 3.0 111-5428 Student id: 1, Last Name: Doe, First Name: John, GPA: 3.00, Phone Number: 111-5428 Current Student Count: 1, Total GPA: 3.00, Average GPA: 3.00 Please enter student id, last name, first name, GPA, and phone number> 2 Smith Mary 4.0 222-5555 Student id: 2, Last Name: Smith, First Name: Mary, GPA: 4.00, Phone Number: 222-5555 Current Student Count: 2, Total GPA: 7.00, Average GPA: 3.50

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Explain discipline and disciplinary action.

Answered: 1 week ago

Question

Q.No.1 Explain Large scale map ? Q.No.2 Explain small scale map ?

Answered: 1 week ago