Question: You are required to write a Java 8 program that has the following user defined classes: Square and Circle. Each class should have the following
You are required to write a Java 8 program that has the following user defined classes: Square and Circle. Each class should have the following methods to calculate area and circumference of two geometrical shapes. Class Square o Method: Area = Length * length o Method : Cir= 4* Length Class Circle o Method: Area = Pi*Radius*Radius o Cir= 2*Pi*Radius Write a test class that will create an object from each class type and call the methods to calculate area and circumference and print it. Dont forget to implement the appropriate constructor(s) for each class. The program will calculate both parameters (Area and Circ) for each shape. Output will be: Shape name, Shape parameters, Shape Area and Circumference.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
