A college offers diploma course with five set modules each. Define a class Student
as an ADT that uses separate files for the interface and the implementation. This class
represents a record of one student’s registration and results. For each Student the
following information should be kept as member variables:
the student’s name, ID, student number, the name of the diploma, average mark, an
array with the five module codes for the diploma, and another array with five results -
one for each of the modules.
Class Student should also have a member function calcAverage() to calculate
the average for the five results and a member function pass() to determine whether
or not a student has passed the module. A student only passes a diploma course if he
or she has obtained more than 50% for all the modules, regardless of his or her
average mark. Member function pass()should return a boolean value.
Add a member function displayResults() to display a student’s results after the
examinations. Member function displayResults() display a student’s name,
student number, name of the diploma registered for, his or her results for each module,
the average mark and whether he or she passed or failed the diploma.
In addition, the class should contain a default constructor that initializes all the member
variables with string values to empty strings and all the member variables with numeric
values to 0. The destructor should print a message “Bye!”.
Include accessor and mutator functions that returns / sets the value of the member
variables for the student’s name, ID, student number, the name of the diploma, and
average mark. The mutator that sets the diploma name, also sets the module names
for the diploma automatically. At the moment the college only offers two diplomas,
Garden Design and Gourmet Cooking. Garden Designs students take modules G1,
G2, G3, G4 and G5, while Gourmet Cooking students take modules C1, C2, C3, C4
and C5. Add an accessor function to return the name of one module and a mutator
function to set the value of one exam result.
Overload the stream insertion << (implemented as a friend function) so that it can
be used to output an object of class Student containing values for all the member
variables of class Student to a file.
Demonstrate the class in an application program (main()) to test your class that does
Initialise an array of three objects of class Student with the following values:
Name John Martin Busi Molefe Sean Naidoo
ID 78120189 81011201 69812018
12345 23456 34567
Diploma Garden Design Gourmet Cooking Garden Design
Display one Student record at a time (name, ID, student number and course) and
capture the exam results for each module for the student from the keyboard. Calculate
the average mark for the student. Once a student’s results have been captured, output
the record to a file RegisteredStudentsResults. Once all the results for all the
students have been captured, use the member function displayResults() to
display the results for each student.
Use the following input data to test your class (each column represents the five results
for the five modules the student in the first row of that column took):
John Martin Busi Molefe Sean Naidoo
55 69 69
65 71 45
59 66 66
68 59 57
60 63 50
using namespace std;
i want to know if what i did so far is correct? im new in coding so please bare with me. I want to ask so now how do I add member variables? and do I write normal operators with averages to be obtained etc? Any assistance would be greatly appreciated.