0

Write a C++ program that defines class Student with data members:
ID, Name, average and array of 5 integer grades.
And member Functions:
- A private function computeAverage: to compute student’s average( the data member).
- A public function getAverage that returns the value of student’s average
- Overload the following operators (either as member function or a friend function)
1. The extraction operator << to read student’s ID, Name and grades
2. The insertion operator >> to display all student’s data (ID, Name, grades and the average)
3. The operator < to compare two student objects in terms of the average
( as member function) for example (the call for this operator):
If (s1<s2) // s1 and s2 are student objects
Cout<<”average of “ <<s1.getName()<<”is less than “ <<se.getName();

  1. The operator + to add an integer value to the students average
    S1+5; // add 5 to the average of object s1
  2. The operator + : to add an integer value to the students average in the form: 5+S1; // add 5 to the average of object s1
2
Contributors
1
Reply
19
Views
3 Years
Discussion Span
Last Post by Ancient Dragon
0

Do that assignment one step at a time. First step is to create the class with the required data items. After that, do each of the other steps one at a time. If you have specific questions then post the code you have written and ask the questions.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.