Answered step by step
Verified Expert Solution
Link Copied!

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 3.14159
The class must have the following methods:
CONSTRUCTOR. This constructor accepts the radius of the circle as an argument.
CONSTRUCTOR. This second constructor, a no-arg constructor that sets the radius field to 0.0.
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 *2
circumference. Returns the circumference of the circle, which is calculated as
circumference =2* 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 steering-wheel as shown in the screenshots below. Once you have these two inputs, create two Circle objects for the pizza and the steering-wheel. 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.format("%,.2f",3.24866) This will give the result 3.25)
IN JAVA
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago