EC327 2009 HW5

EC327 2009 HW5 - resources, it should just display an...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EC327 Introduction to Software Engineering HW #5 – Due Monday Dec. 7, 2009 Score: [ ] Grader: [ ] Name: ___________________ BUID: ___________________ Homework guidelines: You are expected to do individual work on homework assignments. Homework should be handed in during class on the due date. Please use extra sheets as necessary and staple them to this grading sheet. Problem 1 [90 pts] This HW focuses on Inheritance, constructor/destructor, overloading, and Exceptions. Create a parent class CPoly which has the two virtual methods area() and perimeter() . From this parent class derive four other classes for CTriangle, CSquare, CPentagon, and CTrapezoid, each with a constructor for only the minimum parameters required to calculate area and perimeter of that object. In addition to this, derive a third class CCube from CSquare, and create the overloaded area() and perimeter() functions which return the surface area of the cube and its volume instead. Each class should also have a destructor, and in lieu of freeing allocated
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: resources, it should just display an appropriate goodbye message such as Triangle says goodbye. Using cout and cin, ask the user to enter the relevant values before you instantiate these objects and ultimately calculate their area and perimeter values. Use a try-catch clause to capture errand user input, and prompt the user to input those values again until they are correct. Values should be floats. Once all information has been collected, display the calculations for each of the polygons. Problem 2 [10 pts] Describe what happens when you inherit private, protected, and public data from the parent class. What to hand in Please hand in your complete source code, plus an output capture which shows the results of all of the above as well as the scenarios when you type in errand values and are prompted for them again. Resources Please use the resources available at this websites to help with your assignment: http://www.cplusplus.com/doc/tutorial/...
View Full Document

Ask a homework question - tutors are online