Practice Problem on Classes
Practice Problem on Classes
Dietrich
Define a class named tGradeType to keep track of the three test grades (whole numbers) that
a student can get in a semester according to the following rules:
1) An int array named tgrades size 3: stores the three test grades
1) getGrades(first, second, final): returns the three tests grades stored in tgrades array.
2) setGrades(first, second, final): stores the tests grades in tgrades array.
3) avgGrade(): returns the average of the three tests as a whole number.
4) default constructor: initializes all test grades to 0.
5) parameterized constructor: initializes all test grades to the values specified by the client
program.
Client program:
Feel free to add more members (data and/or functions) to the class if you like (for example full
name, comparison of average grades, etc.) and/or more method calls in the client program.
Watch the videos about designing, creating, and using a class before you write your
program.
Next, use pseudocode to describe what the member functions and main() must do.
CSCI 2380 Spring 2025 Mr. Dietrich
I am providing you my sample solution so you can use it as a reference regarding how your
program should behave.