Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
10 points QUESTION 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. + Set Radius 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 - Pradius. 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 drcle's area, diameter and circumference Create another circe 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) B. IUS Baragarh Ana 11 111 ili 2

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

Starting Out With Java From Control Structures Through Data Structures

Authors: Tony Gaddis

6th Edition

0133957055, 978-0133957051

More Books

Students also viewed these Accounting questions

Question

2. Develop a good and lasting relationship

Answered: 1 week ago

Question

1. Avoid conflicts in the relationship

Answered: 1 week ago