Computer Science Question

CSCI 270-01-Assignement – 2: Abstract Base Class and MultipleInheritance
(70 points)
Due October 31, at 11:55 pm
Part 1: Multiple Inheritance (40pts)
Exercise 1 – Class Date (14pts)
1. (4pts)Create a class named Date with the following protected attributes:
int day;
int month;
int year;
2. (4pts)Implement the constructors with and without parameters of the class Date.
3. (6pts)Implement the getters and setters of the class Date.
Exercise 2 – Class Time (14pts)
1. (4pts)Create a class named Time with the following protected attributes:
int hou;
int min;
int sec;
2. (4pts)Implement the constructors with and without parameters of the class Time.
3. (6pts)Implement the getters and setters of the class Time.
Exercise 3 – Class DateTime (12pts)
1. (2pts)Create a class named DateTime that inherits from the classes Date and Time. The
access specifier for the classes Time and Date is public.
2. (4pts)Implement the constructors with and without parameters of the class DateTime.
3. (2pts)Implement the function showDateTime that displays the date and time.
4. (4 pts)Test your code by creating two objects of type DateTime; the first object using the
constructor without parameters and the second object using the constructor with
parameters.
Display the date and time of the two objects by calling the function showDateTime.
Example of the output of the function showDateTime for the two objects
1/1/1900 0:0:0
02/25/2009 6:20:55
1
Part 2: Abstract Base Class and Pure Virtual Functions (30pts)
Exercise 1
1. (3pts)Create an abstract base class named: Shape. The class Shape contains a public pure
virtual function named display();
2. (3pts)Create another class named: Rectangle. The class Rectangle contains the following
private properties:
double width;
double length;
3. (4pts)Implement the constructor with and without parameters of the class Rectangle.
4. (4pts)Implement the getters and setters of the class Rectangle.
5. (2pts)Override the function display of the class base Shape to display the length and width of
the Rectangle.
6. (2pts)Create another class named: Cube. The class Cube contains the following private
property:
double height;
7. (4pts)Implement the constructor with and without parameters of the class Cube.
8. (2pts)Implement the getters and setters of the class Cube.
9. (2pts)Override the function display of the class Rectangle to display the length, width and the
height of the Cube. Do not forget to call the function display of the class Rectangle.
10. (4pts)Test your code by creating two objects:
A Rectangle r1 of width = 5 and length = 9;
A Cube c1 of width = 4, length = 7, and height = 10;
Display the dimensions of the rectangle r1 using the function display.
Display the dimensions of the cube c1 using the function display.
2

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER