The gradeRecord class maintains student records for the registrar.
Its attributes include the string studentID,
along with integers for the units
(total number of units attempted) and gradepts
(total grade points earned).
These data members can be used to compute the gpa of the student by
using the formula
gpa = gradepts / units
The forgoing figure represents an object named studObj.
The gpa, computed by the object, is
3.45.
Declare a C++ class to do the following
operations:
The operations include gpa(),
which computes and return the GPA, and updateGradeInfo(),
which takes new units and grade points as arguments and updates the grade
record. The operation writeGradeInfo
outputs the current status of the grade record in the following format:
Student:783-29-4716
Units:100 GradePts:345 GPA:3.45
Your jobs are followed:
(a) Declare the above class and implement
all member functions and constructor.
Steps: 1. What is name of class?
2. How many member are there and what are they?
3. Which one is data member and which one is function member?
4. Which one is private information and which one is public information?
5. If it is data member, what is name of it and what is its data type?
6. If it is constructor, how do you write the function header for it and how
do you implement it?
7. If it is a function member, set up the function header and remember that
there are three parts of
a function header with the interface skill in it. You need to implement
function members, too.
(b) Write a main function that declares the gradeRecord object tMartin
with initial values "716-29-4238" (studenID), 20 (units), and 50 (gradepts).
Output the initial GPA. After completing the semester, the
student represented by object tMartin adds 15 units and 40
grade points. Update the grade record, and output the new grade-record
information. |
Send your C++ programs with the attachment to me at extrapo66@yahoo.com |