Question: 4. Describe abstract class called Shape. This class has three subclasses called: Triangle, Rectangle and Circle. Define one method area () in the abstract class
4. Describe abstract class called Shape. This class has three subclasses called: Triangle, Rectangle and Circle. Define one method area () in the abstract class and override this area() in these three subclasses to calculate the area for specific class object.
5. Declare a class called coordinate. This is to represent 3 dimensional Cartesian coordinates (x, y and z). Define the following methods:
a. Constructor b. Display, to print values of members c. Add_coordinates, to add three such coordinate objects to produce a resultant coordinate object. Generate and handle exceptions if x, y and z coordinate of the result are zero. d. Main, to show use of the above methods.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
