ENSC 251 Lab Assignment 2
In the ENSC 251 course, you will work on a multi-lab project: you will design and implement a simplified graduate student admission system using the skills learned throughout this course (Object-Oriented Programming with C++). This will include four incremental labs in total, each weighing 10% of the final mark. Each student will work on the lab assignments individually and will be evaluated individually.
More description of the simplified graduate admission system was given in lab assignment 1. In assignment 1, you have built the four classes that you will use throughout the four lab assignments. Now we are moving to lab assignment 2, which will be based on lab assignment 1. For those students who didn’t do well in assignment 1, the TAs will post the code of assignment 1 from those top students who got bonus points, and you are free to use their assignment 1 code as basis for your assignment 2.
Lab Assignment 2:
Assume there are a number of domestic and international student applicants who are applying to SFU graduate school, and their profile is stored in domestic-stu.txt and international-stu.txt, which you are already able to read in assignment 1. In lab assignment 2, assume we have a fixed number of domestic and international applicants which we know beforehand, and both numbers don’t exceed 100 (i.e., no more than 100 domestic student applicants, and no more than 100 international student applicants). You will have to achieve the following goals:
1. Use arrays or vectors to store all the DomesticStudent and InternationalStudent objects, which are read and initialized from the input files.
2. Implement the following friend functions for Student class—compareCGPA, compareResearchScore, compareFirstName, compareLastName—so that you can compare the CGPA, research score, first name, last name of two DomesticStudent objects (and two InternationalStudent objects). Each of these functions should return three kinds of values: less than, equal to, or greater than. For lab assignment 2, we don’t compare a DomesticStudent object against an InternationalStudent object.
3. Overload the << operator of DomesticStudent and InternationalStudent classes to print out the object information.
4. Based on the user input, sort all DomesticStudent (and all InternationalStudent) objects in the array or vector by their CGPA, research score, first name, last name using these friend functions, and print out the sorted array or vector of objects. Your program should be able to take input from a user (hint: using cin). For example, if user types in ‘c’, you should sort all DomesticStudent (and all InternationalStudent) objects based on their CGPA, and print out the sorted objects. A better approach is to first ask a user to select DomesticStudent or InternationalStudent, and then ask a user to select the field that they want to sort. Note each time the sorting is based on a single filed.
5. Based on the user input (if a user chooses an overall sorting), sort all DomesticStudent (and all InternationalStudent) objects in the array or vector, such that they are first sorted based on their CGPA. If they have the same CGPA, then they are further sorted based on their research score. If they further have the same research score, then they are sorted by their province (for DomesticStudent) or country (for InternationalStudent). For InternationalStudent, if their TOEFL score doesn’t meet certain conditions, we drop the
object from the sorting process. The standard is as follows: the minimum overall TOEFL score is 93 with a minimum of 20 in each category (reading, listening, speaking, and writing). In contrast to point 4 where sorting is based on a single field, this overall sorting is based on multiple fields as we described. And you may want to add some friend function or operator overloading to the DomesticStudent and InternationalStudent class. Similarly, after this overall sorting, you will print out all the sorted objects.
Always note that in addition to the actual coding for implementation, you need to provide good commenting, naming, and other good coding styles (including the header file style to avoid the multiple includes problem); all these count in your lab assignment 2 marking.
Note: For grading logistics and remote machine access, please refer to the course website. If you have any questions, please post them on Piazza.
Your lab assignment 2 will be submitted electronically through CourSys. You will need to submit a single lab2.zip file. Failure to comply with this format could result in zero score on this assignment.
Considering the midterm exam, your lab assignment 2 is due at 11:59:59pm on Thursday, June 20th, 2019. You need to meet the deadline: every 10 minutes late submission, you lose 1%; that is, 100 minutes late, you will get zero on this lab.
You will have to demo your lab assignment 2 to the TA in the Friday (June 21st, 2019) lab session. Each student has around 8 minutes to explain your code to the TA. If you arrive late for your lab demo (based on the starting time of your assigned lab session), you will lose one point (total is 10 points). If you fail to do the demo (without a medical note), or if it is determined that you do not understand the code being evaluated, you will be awarded zero on lab assignment 2.