icon

UseTopicwritingscode to get 5% OFF on your first order!

Student

For this project, each student may choose to work on it individually, in pairs, or in a group of 3 students. In this project, you need to implement a Student class. You may copy the code from your midterm project into this project, if necessary. The class should include the following:

First, the Student class should have the following private attributes/fields/data members:

name
student id
major
gpa
an array of String type named courses to store 10 courses, such as “CS 1400”, “Math 1080”.
an array of String type named courseLetterGrades to store 10 course letter grades, each grade is a String type value such as A, A+, A-, B, B+, B-, C, C+, C-, D, D+, D-, F.
an array of int type named courseCredits to store 10 course credits, each credit is an integer value between 1 and 5.
an array of double type named course4.0ScaleGrades. The mapping from a letter grade to a 4.0 scale grade is given by the following table:
LetterGrades-2-4.0ScaleGrades.png

Second, the Student class should have the following constructors:

a constructor without any arguments
a constructor with two arguments: name and id
Third, the Student class should have the following getters/setters:

a getter for name
a getter for student id
a getter and a setter for major
a getter for gpa
Fourth, the Student class should have the following use-defined methods:

a method void initCourses(String[] values). This method takes an array of String type as the argument and it initializes the courses field with the argument array.
a method void initCourseLetterGrades (String[] values). This method takes an array of String type as the argument and it initializes the courseLetterGrades  field with the argument array.
a method void initCourseCredits  (int[] values). This method takes an array of int type as the argument and it initializes the courseCredits  field with the argument array.
a method void convertLetterGradesTo4.0ScaleGrades(). This method uses the table shown above to convert the letter grades stored in the courseLetterGrades to 4.0 scale grades and save them to course4.0ScaleGrades array.
methods getHighestGrade(), getLowestGrade(), getTotalCredits() to return the highest letter grade, the lowest letter grade, and the total number of credits from the 10 courses.
a method calculateGPA(). This method calculate the student’s gpa (gpa = (4.0 scale grades * credits) / total credits).
a method print(). This method print the student name, id, total credits, and the gpa information.
Finally, the Student class should have a main method, in the main method, do the following:

create two student objects, initial their data members either by user input or by using arrays.
print their information by calling their print() method.

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes