Question: Please I need write java code the following steps: 1. Create a class Students with the following private attributes: studentID: int studentName: String studentEmail: String
Please I need write java code the following steps:
1. Create a class Students with the following private attributes:
studentID: int
studentName: String
studentEmail: String
grade1:int
grade2:int
grade3:int
2. Implement all necessary getters and setters.
3. Create one empty constructor and one parameterized constructor where you will initialize all integer values to 0, student name to Default student and student email to Default email.
4. Create a method findAvg() that finds and returns the average grade of a student.
5. Create a method toString() that prints all the information about the student ( see example below).
Student John Doe can be contacted via the email address; (jdoe@mail.com) The students grades are 70,80,77.
6.Create a class MyMain where you will have two methods: the main() method and a compare method.
In the main method create three Student objects. Create the first object student1 by calling the empty constructor. Then call the necessary methods to assign the following values to student1: studentID:16201, student name: John Doe, email:(jdoe@mail.com), grade1:70.grade2:80, grade3:77. Create the second objct by calling the parameterized constructor with the following values: studentID:16202, student name: Rachel Green, student email:( rgreen@mail.com), grade1:60.grade2:92, grade3:74. For the third object student 3, prompt the user to enter the values.
Define the compare method to accept three objects as arguments: compare(Student s1, Student s2, Student s3). The method should compare the averages of the students and print the information of the student with the lowest average.
7. Call the necessary methods to print the student names. Display the averages for every student. Call the compare method to display which student has the lowest average.
See example: Registered students: John Doe, Rachel Green, Joey Tribbiani Students averages are: 75.6, 75.3, 69. The student with the lowest average is: Joey Tribbiani, the email address is( jtribbiani@mail.com), and the grades are 68,73,66.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
