Question
C++ with SLT Part 1 In this part, you design and implement all the classes in the UML diagram on the last page. Polymorphism is
C++ with SLT Part 1
In this part, you design and implement all the classes in the UML diagram on the last page. Polymorphism is emphasized.
a) general specifications:
Data members of Student class are protected All member functions are public; constructors may have several parameters In Student class, functions print() and tuition() are virtual and tuition() is pure (they must be overridden in DCL) Print functions must print all the data members in a nice format (e.g. add endl; student name: ***, etc)
b) call print() and tuition() for the following three students using both static and dynamic binding:
under_rate = 380.0; grad_rate = 500;
Mary, 000111222, Junior, 12 credits, her tuition, her gpa (4.0) David, 111222333, graduate student, 9 credits, his tuition, his thesis (How to learn data structures using C++/STL?), his gpa (3.7) Jason, 222333444, graduate assistant, 9 credit hours, his tuition, his thesis (Design of efficient algorithms), his gpa (3.9) his task (Grading 330 projects and implementing a data mining algorithm), his hourPay ($20), his superviser (Dr. Smith) These are just facts data; your final output may look differently (but nicely).
Part 2 (45 points)
This part involves I/O streams, files, and STL.
Suppose that input undergraduate roster is a text file in which fields are separated by white-space and records by . For example, the first record (the fields are all in the following order: name, ssn, year, credits, gpa) could be
Mary, 000111222, Junior, 12, 4.0
(10) Scan (read) the file and construct students one by one. Notice that, you should check the input data according to part a. (5) Store the students in a list container (can insert one by one). (5) After all students are scanned and pushed into the list, delete the last student and insert him/her to the front as the first student. (10) Then print out on screen all the students using list iterator in the following format:
Header line:
Name SSN Year Credits Tuition GPA
In each line (including the header), each fields width is 10 except Name whose width is 20. The last two fields are right-justified and have two fraction digits. Tuition must be padded with $ sign to the left. All other fields are left-justified.
Then initialize a vector that contains the above list data and sort the students according to GPA. You must use generic sort algorithm (therefore need to overload < operator). After sorting, output the sorted students using the above format.
PS:The project mainly covers three features: STL, inheritance and polymorphism
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started