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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started