Lab 5 Part 2: Classes
Due: Tue, March 26, 11:59 pm
Part 2a: Implement Lab 5 Part 1 using a class this time. but you do NOT need to sort the data this time.
Requirements/Specifications:
All the data members of Student class (name, score, grade) must be private.
Define appropriate member functions to set and access private data.
Define appropriate constructors.
After taking the input from the user, the program should print out
i) the name of each student together with student's letter grade.
ii) the highest test score and the name(s) of students who received the higheest score.
Do not forget to define the default constructor (Remember, once you define a constructor with at least one parameter, the compiler's default constructor is no longer available. See the programming tip on page 568-9)
Requirement | Points |
---|---|
Fulfillment of all of the specifications listed above | 40 |
Correct output data for all sets of input | 50 |
Complete source code with good formatting, variable names, and comments | 10 |
Total | 100 |
Part 2b) Write a definition of a class named Point that can be used to store and manipulate the location of a point in the 2 dimensional plane. You will need to declare and implement the following member functions:
0) appropriate constructors
i) a member function set that sets the private data after an object of this class is created
ii) a member function to move the point by any amount along the vertical and horizontal directions specified by the first and second arguments
iii) two accessor functions to retrieve the current coordinates of the point
iv)*** a member function (with one parameter) to rotate the point by a specified amount of degrees (given by the argument) counter-clockwise around the origin *** Writing this function will be bonus. You will need some trigonometry, and some mathematical functions from the cmath library. Using polar coordinates will help. Try this after finishing other parts.
Embed your class in a test program that requests data for several points from the user, create the points, then uses the member functions. Writing a good/reasonable main program that tests essential features of this class is part of the assignment.
Requirement | Points |
---|---|
Fulfillment of all of the specifications listed above | 20 |
Writing a reasonable test program that tests all features with correct results | 50 |
Complete source code with good formatting, variable names, and comments | 10 |
Total | 80 |
Bonus Part | 10 |