I have written part of the program nut got stuck on the student class. You must
ID: 3648321 • Letter: I
Question
I have written part of the program nut got stuck on the student class.You must create the following classes which will be used to compute a student's final course grade (for an example class):
Exam
Coursework
Student
The Exam class represents the percentage (score) and letter grade (grade) received for an exam. It must:
-have a private instance variable that keeps track of an integer score
- have a private instance variable that keeps track of a letter grade (as a string)
- have a constructor which takes two arguments, an int and a String, which are used to populate the instance variables (due to possible curves for exam scores, the integer score may not match the typical letter grade)
- have ``get'' functions to get the score and grade
-ensure that scores are between 0 and 100 (if a score less than 0 is used, it should be rounded up to 0, if a score greater than 100 is used it should be rounded down to 100)
- ensure that the letter grade is either A, B, C, D, or F. If a value other than those is used, a warning message should be printed to the console that an invalid grade was entered, and the value ``F'' should be used.
The Coursework class represents the combined scores for a collection of similar work such as homework or in-class activities. It must:
- have a private instance variable that keeps track of the total (sum) of the scores
- have a private instance variable that keeps track of the number of scores that have been totaled
- have a function that allows you to add a score
- have a function that returns the average of the scores as a double
The Student class represents a student and is used to for entering grades and computing and printing the final course grade. It must:
- have a private instance variable that keeps track of the student's first name as a string (and one for the last name)
- have a private instance variable of type Exam that keeps track of the student's midterm exam score and grade (and one for the final exam)
- have a private instance variable of type Coursework that keeps track of the student's homework total (and one for in-class activities)
- have a constructor which takes 2 String arguments, one for the first name and one for the last name (in that order)
- have the following member functions (implemented):
public void setMidterm(int score, String grade)
public void setFinal(int score, String grade)
public void addGradedHomework(int score)
public void addGradedActivity(int score)
public void printGrade()
- calculate and output the student's final course grade when printGrade() is called as follows:
The weighted course percentage should be computed as follows: (activity average * 15%) + (homework average * 25%) + (midterm score * 25%) + (final score * 35%)
Based on the weighted course percentage, a letter grade should be computed as: F (<60), D (>=60, <70), C (>=70, <80), B (>=80, <90), A (>=90)
Follow the formula strictly (i.e. a score of 79.88% is a C and doesn't round to 80% and a B).
Because the professor thought that performance on the exams was low, he curved them so that the percentages for exams don't necessarily align with the letter grades for them. Also, since the exams were difficult, he decided that no student's final course grade would be lower than the lowest letter grade they received on an exam. Therefore, if their weighted percentage puts them in a grade category lower than that of their lowest exam, their course grade should be adjusted upward to match that of their lowest exam grade.
The student's full name along with their final letter grade and weighted percentage (between 0 and 100, rounded to exactly two decimal places) must be output to the console. The output line must begin with "Final course grade for" and then include the studen'ts name, letter grade, and percentage.