Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please solve 3 questions about the code 3) Consider the following class and answer the questions that follow: public class Circle { public

can you please solve 3 questions about the code
3) Consider the following class and answer the questions that follow:
public class Circle {
public static final double PI = 3.14159;
private double radius;
private double area;
public Circle(double r) {
radius=r;
}
public void calculateArea() { }
public String toString() { }
}
3.1 Complete the body of the method calculateArea() to calculate the area of the
circle.
3.2 Complete the body of the method toString() to return a string representation of the circle in this format:
Radius=the radius rounded to 2 decimal places
Area=the area rounded to 2 decimal places
3.3 Following the toString() method, add an accessor and mutator for the instance variable radius.

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_2

Step: 3

blur-text-image_3

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago