Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Write a Circle class that has the following fields: -radius: a double Pl: a final double initialized with the value 3.14159 The class should

1 Write a Circle class that has the following fields: -radius: a double Pl: a final double initialized with the value 3.14159 The class should have the following methods: +Constructor. Accepts the radius of the circle as an argument. +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. +getArea. Returns the area of the circle, which is calculated as area Pi radius radius +getDiameter. Returns the diameter of the circle, which is calculated as diameter radius 2 +getcircumference. Returns the circumference of the circle, which is calculated as circumference 2. Pl radius getPl. Returns the value of PI +toString. Return a string representing a circle to include radius, area and circumference labeled + equals. Returns true if radius of the circle passed to is the same as the object itself otherwise returns false Write a program to test the Circle class by asking the user for the circle's radius, creating a Circle object. and then reporting the circle's area, diameter, and circumference. Create another Circle and use equals to compare the 2 Circles and print the same if they are the same otherwise print not the same For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac) BIUS Paragcaph 100t 111 10 points A

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

Managerial Accounting Custom Publication

Authors: Belverd E. Needles

7th Edition

0618681922, 978-0618681921

More Books

Students also viewed these Accounting questions