[Solved] CS_1C Homework 9-Abstact Classes & Virtual Functions

$25

File Name: CS_1C_Homework_9-Abstact_Classes_&_Virtual_Functions.zip
File Size: 489.84 KB

SKU: [Solved] CS_1C Homework 9-Abstact Classes & Virtual Functions Category: Tag:
5/5 - (1 vote)

HW09 Abstract Classes & Virtual Functions

  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.

Use the command script to capture your interaction compiling and running the program, including all operations, as shown below:

CS1C Fall 2018 TTH HW09 50pts Due: Th 10/11/2018

[email protected] ~/cs1c/hw/09 $ script hw09.scr Script started, file is hw09.scr [email protected] ~/cs1c/hw/09 $ date

[email protected] ~/cs1c/hw/09 $ ls -l

[email protected] ~/cs1c/hw/09 $ make all

[email protected] ~/cs1c/hw/09 $ ls -l

HW09 Abstract Classes & Virtual Functions [50 pts]

[email protected] ~/cs1c/hw/09 $ ./hw09

// print out output from steps 4 thru 6

[email protected] ~/cs1c/hw/09 $ exit Script done, file is hw09.scr

[email protected] ~/cs1c/hw/09 $ make tar

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS_1C Homework 9-Abstact Classes & Virtual Functions
$25