Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IN JAVA PLZ You must use the concept of class and objects we learned in the class to complete this program. Write a Circle class
IN JAVA PLZ You must use the concept of class and objects we learned in the class to complete this program. Write a Circle class that has the following fields:
radius: a double
PI: a double initialized with the value
The class must have the following methods:
CONSTRUCTOR. This constructor accepts the radius of the circle as an argument.
CONSTRUCTOR. This second constructor, a noarg constructor that sets the radius field to
setRadius. A mutator method for the radius field.
getRadius. An accessor method for the radius field.
area. Returns the area of the circle, which is calculated as
area PI radius radius
diameter. Returns the diameter of the circle, which is calculated as
diameter radius
circumference. Returns the circumference of the circle, which is calculated as
circumference PI radius
You may not use all these methods mentioned above when executing the program. However, you still need to have the above list implemented for future use.
Write a program that demonstrates the Circle class by asking the user for a pizzas radius in a dialog box. Then ask the user to enter the radius of a steeringwheel as shown in the screenshots below. Once you have these two inputs, create two Circle objects for the pizza and the steeringwheel. Finally, display each of these objects' area, diameter, and circumference in a dialog box as shown in the screenshot. Note if you want to round a number in a dialog box, you can use: String.formatf This will give the result
IN JAVA
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