Question: Implement StudentRecord class ~Private member variables: int CWID, double grade ~Implement appropriate constructors and accessor/mutator functions Overload +, == for StudentRecord class == compares CWID

Implement StudentRecord class

~Private member variables: int CWID, double grade

~Implement appropriate constructors and accessor/mutator functions

Overload +, == for StudentRecord class

== compares CWID

+ adds up grades for students

Creates new StudentRecord object

New CWID = old CWID1 + old CWID2

Overload either as member or non-member functions

Now, overload the > operators In your main() function, you can now do

Sample input:

123 50 234 25 

Sample output:

Enter student's CWID, followed by grade: Enter student's CWID, followed by grade: This student has CWID 123 and grade 50 This student has CWID 234 and grade 25 This student has CWID 357 and grade 75 

Implement StudentRecord class ~Private member variables: int CWID, double grade ~Implement appropriate

1 #include kiostream using namespace std; 4 class StudentRecord 5 public Student Record CWID (0), grade (0) Student Record (int c, double g) CWID (c), grade (g) 10 int getCWID const (return CWID: double getGrade const return grade 12 void setCWID (int c) 13 14 CNID 15 void setGrade (double g) 16 17 grade 18 19 const StudentRecord operator (const StudentRecord& other) 20 bool operator (const studentRecord& other) 21 22 //declare and overload and Qeravors 23 24 private 25 int CWID; double grade; 26 27 28 29 const StudentRecord StudentRecord operator (const StudentRecord& other) return StudentRecord (CWID other getCWID grade other. getGrade 30 31 32 33 bool Student Record operator J (const StudentRecord& other) if (CWID other. get CWID 34 35 return true; 36 return false; 37 38 39 40 //define and overload and Rekavors 41 42 int main 43 Student Record eric, nick 44 cin ric nick; 45 cout eric nick; 46 47 Student Record enik eric nick; 48 cout nik 49 50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!