You are required to implement the class, i.e. to develop the implementation file “Student.cpp” that
conforms to the following specifications:
(1) The data fields have self explanatory identifiers, and their meaning should be clear from the
Introduction.
(2) The “set” functions allow the user to set the assessment task marks within the specified margins,
e.g. setExamMark ensures that the examMark is in the appropriate range – from 0 to 50.
[0.25 ×4 = 1 mark]
(3) The function getGrade() returns the student’s grade, calculated as specified in the Introduction.
The rest of the “get” functions simply return the values of the corresponding fields.
(4) The function passed() returns true if this student , has passed the course, and returns false
otherwise (see the Introduction).
[1 mark]
(5) friend ostream& operator<<(ostream& stream, const Student &) – the function
overloads << operator, which allows a Student object information to be output in the following
format:
Underwood Scott:
Assignment 1 8
Assignment 2 16
Lab Test 0
Exam 34
Grade P
[2 marks]
(6) bool operator<(const Student &student)const – the function overloads < operator,
which allows to compare student’s full names lexicographically.
[2 marks]
[Total for Task 1: 7 marks]
The only field of the class is a pointer to a “map<string,Student>” object representing a
teaching group(or class), which is a map (an associative STL container) that contains the pairs:
Key: a student’s full name (i.e. name + “ “ + surname)
Value: corresponding Student object.
In this assignment you should assume that there are no different students with identical full names
in ITECH7603 teaching classes.
(2) void addStudent(Student* studentPtr)- the function adds the pair
Key: (*studentPtr) student’s full name
Value: (*studentPtr)
To the (*group) map;
Please note that instead of actual objects you are supposed to use pointers as function parameters.
[1 mark]
(3) void save()- the function writes the Student objects stored as values in the (*group) map to
the “ITECH7603Students.bin” file. “ITECH7603Students.bin” is a binary file, and you are required
to write the objects to the file using something like
out.write(reinterpret_cast<char*>(s), sizeof(Student));
[2 marks]
(4) Constructor ITECH7603Class() and the destructor:
A default constructor initializes dynamically the group field.
The destructor deletes the group pointer.
[0.5×2 = 1 mark]
(5) Constructor ITECH7603Class(int dummy):
This constructor does not require any parameter. However, to distinguish it from the default
constructor you should use some dummy argument (say of int type). This constructor opens the
“ITECH7603Students.bin” file, if such file exists, and reads information from the file into the
(*group) map using addStudent() function. If the file “ITECH7603Students.bin” does not exist, the
constructor behaves as the default constructor.
[2 marks]
(6) Constructor ITECH7603Class(set<Student>* students):
This constructor takes a set of Student objects (in fact, a pointer to the set) as an argument and adds
students from the set to the (*group) map, i.e. initializes the group field.
[2 marks]
[Total for Task 2: 8 marks]
The test program should conform to the following specifications:
(1) There are three three global variables declared in the program:
vector<string>* names = new vector<string>();
vector<string>* surnames = new vector<string>();
set<Student>* students = new set<Student>();
(2) The test program should define a function with the following prototype:
void readInputFiles();
This function does the following:
• Opens and reads firstNamesBoys.txt. Each name should be read into a string and added to
the vector<string>* names.
• Opens and reads firstNamesGirls.txt. Each name should be read into a string and added to
the vector<string>* names.
• Opens and reads lastNames.txt. Each name should be read into a string and added to the
vector<string>* surnames.
[2 marks]
(3) The test program should define a function with the following prototype:
void createRandomStudentSet(int n);
This function creates Student objects choosing values for their fields randomly:
• Value for first name is chosen randomly from the vector (*names).
• Value for surname is chosen randomly from the vector (*surnames).
• Values for the rest of fields are chosen randomly from the corresponding ranges, e.g. value
for the examMark is a random value from 0 to 50.
If thus created Student object has passed the course it is added to the (*students) set (an associative
container from STL). You should continue adding random Student objects to the set until the total
number of Student objects in the set is n.
[2 marks]
(4) The main function performs the following tasks:
• Invokes consecutively functions readInputFiles(), createRandomStudentSet(12).
Then creates a ITECH7603Class object (or a pointer to the object) using the constructor
ITECH7603Class(students), and saves it (to the file “ITECH7603Students.bin”).
• Creates another ITECH7603Class object using the constructor with a “dummy” parameter
and prints information of the Student objects from the (*group) map field of the class.
[1 mark]
[Total for Task 3: 5 marks]
Specially designed essay help services have made MyAssignmenthelp.com one of the most prolific proposal essay help providers. We have arrays of expert essay writers who successfully deliver essay help depending on broad ranges of subjects and topics. We provide nursing essay help, MBA essay help, English Essay writing help and law essay help to students from different fields of study. Broad ranges of essay writing services assist us to offer quality contents within a specific time limit.
Just share requirement and get customized Solution.
Orders
Overall Rating
Experts
Our writers make sure that all orders are submitted, prior to the deadline.
Using reliable plagiarism detection software, Turnitin.com.We only provide customized 100 percent original papers.
Feel free to contact our assignment writing services any time via phone, email or live chat. If you are unable to calculate word count online, ask our customer executives.
Our writers can provide you professional writing assistance on any subject at any level.
Our best price guarantee ensures that the features we offer cannot be matched by any of the competitors.
Get all your documents checked for plagiarism or duplicacy with us.
Get different kinds of essays typed in minutes with clicks.
Calculate your semester grades and cumulative GPa with our GPA Calculator.
Balance any chemical equation in minutes just by entering the formula.
Calculate the number of words and number of pages of all your academic documents.
Our Mission Client Satisfaction
Dear Expert Thank you for your service and support. The work was good, I got 72%.
Australia
WHAT AN FANTASTIC OUTCOME I RECEIVED!! My essay subject was very difficult with many parts! My MAH\'s expert NAILED IT!!!! thanks a million! I WILL BE BACK!
Australia
It was a very well done job. The writings are accurate and supported with reliable resources which were related to the assignment. It was done on time and quick service.
Australia
Hi, Received the grades for this assignment this morning. Good grades with some minor feedback. Professor is happy with the content, referencing and especially the way assignment was written. Please pass on my thanks and regards to the expert who did...
Australia