Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective and Overview: Exercise on User-defined classes Exercise 1: (The Student class) Design a class named Student that contains a name, a GPA, a quizzes
Objective and Overview: Exercise on User-defined classes Exercise 1: (The Student class) Design a class named Student that contains a name, a GPA, a quizzes grade, a midterm grade, and a final grade. 1. Choose an appropriate type for each of the attributes of the class Student 2. Create the class Student with all its attributes. Make all attributes private. 3. Create a default constructor for the class Student 4. Create an initialization constructor for the class Student to initialize all attributes 5. Create public accessors and mutators for all attributes of the class Student 6. Create the toString() method in the class Student to return a string that represents all attributes inside the class Student 7. Add a public method getTotalGrade) in the class Student to return the total grade for a student (which is the quizzes, the midterm and the final grades combined). 8. Create another class with a main method, call it TestStudent 9. In the main method, create a student si using the default constructor with name="all", GPA = 4.0, quizzes grade -45, midterm = 20, and final = 28 10. Display the student si using its toString() method 11. Display the total grade for the student si 12. Create another student s2 using the initialization constructor with name="Mariam", GPA = 3.9, quizzes grade = 49, midterm = 19, and final = 30 13. Display the students using its toString() method 14. Display the total grade for the students 15. Open a file, called "student_info" and read all lines in the file one by one. When reading a student info, create a student object, and display it using its toString(). Assume that you do not know the total number of students in the file. 16. After reading all students, display the average total grade for all students. 17. After reading all students, display the student information with the highest GPA using its toString() method Sample input file Hassan 3.5 40 18 25 2.0 35.5 18.5 Asmaa 3.8 39 20 30 Zainab 4.0 49 AN 27 19 29
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started