Question
Write a object called Circle. Declare the following integer variables for the object Circle, radius, diameter, and pi is declared as double. Create the following
Write a object called Circle. Declare the following integer variables for the object Circle, radius, diameter,
and pi is declared as double. Create the following for the Circle object:
Implicit constructor (default constructor)
Void method Calculate (double pi, int radius) to calculate the area of the Circle object. The method must include a system.out statement that
displays the area value. Use the following formula to calculate area of the circle:
Area = pi * (r * r)
The program includes a main class called Shape with a reference c1 to the Circle object. Pass the following values to the object Circle:
radius = 4
diameter = 8
pi = 3.14
Include output statements to view the values passed to the object Circle.
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