Starting from:

$30

CS1C-Homework 9 Abstract Classes & Virtual Functions Solved

1.    Create an abstract class called Shape with pure virtual members called calcPerimeter and calcArea.   Create subclasses of Shape called Rectangle and Triangle that inherited the pure virtual members above. 

 

2.   Write two non-member functions called printPerimeter and printArea that call the methods calcPerimeter and calcArea respectfully.

 

3.   Instantiate a Rectangle and a Triangle object.

 

4.   Input the length and width of a rectangle and then call the functions printPerimeter and printArea.

 

5.   Input the length of the three sides of a triangle and then call the functions printPerimeter and printArea.

 

6.   Output the perimeter and area of the rectangle and triangle objects.

More products