Description
Design and implement a set of classes that define a series of three-dimensional geometric shapes. This design must use inheritance, one base class and at least two derived classes. For the shapes store fundamental data about its size and provide methods to access and modify the data. There should be data in the base class and in the derived classes. The data should be template data types, so that instances of the classes can be created with data types of int, double and float. The design should include methods to calculate the circumference, area and volume of the shapes.
An exception class should be created to indicate that one of the data member of the shape is negative. The exception should provide an appropriate message about what it wrong and which data member is wrong and its value. The exception should be thrown when doing the calculations. Main should throw the exception and handle the exception, which then allows the user to enter new value for the data so it can be corrected and the calculations are performed.
The driver class should create an instance of each of the derived classes. The driver should show that all of the method works correctly and the exceptions are handled correctly. The shapes should use different data types to create the instance (int, double, or float).
Explanation & Answer
Check and le...
Review
Review
24/7 Study Help
Stuck on a study question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
Freakonomics
by Stephen J. Dubner and Steven D. Levitt
Twilight
by Stephenie Meyer
The Call of the Wild
by Jack London
Frankenstein
by Mary Shelley
The Handmaids Tale
by Margaret Atwood
A Brief History of Humankind Sapiens
by Yuval Noah Harari
How to Win Friends and Influence People
by Dale Carnegie
Where'd You Go Bernadette
by Maria Semple