subject

1. write a tostring method for this class. the method should return a string containing the radius and area of the circle.

2. write an equals method for this class. the method should accept a circle object as an argument. it should return true if the argument object contains the same data as the calling object, or false otherwise.

3. write a greaterthan method for this class. the method should accept a circle object as an argument. it should return true if the argument object has an area that is greater than the area of the calling object, or false otherwise.

this is what i have but i have one error that i can't figure out how to fix: the error is line 3, where it says private double radius. when i use the suggested fix on netbeans (which changes it to private final double radius) i just another error saying illegal use of expression or something. can someone

public class circle {
{
private double radius;

public circle(double r)
{
radius = r;
}

public double getarea()
{
return math. pi * radius * radius;
}

public double getradius()
{
return radius;
}

public string tostring()
{
string str;
str = "radius: " + radius +
"area: " + getarea();
return str;
}

public boolean equals(circle c)
{
boolean status;

if(c. getradius() == radius)
status = true;
else
status = false;

return status;
}

public boolean greaterthan(circle c)
{
boolean status;

if(c. getarea() >
status = true;
else
status = false;

return status;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 24.06.2019 15:50
Subscribe to j p g a m e t u b e on you tube ?
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
Pressing the backspace key deletes the text to the of the insertion point. the left or the right?
Answers: 1
question
Computers and Technology, 24.06.2019 19:00
In python a floating-point number must be written using scientific notation?
Answers: 1
You know the right answer?
1. write a tostring method for this class. the method should return a string containing the radius a...
Questions
question
Mathematics, 23.11.2020 21:10
question
Mathematics, 23.11.2020 21:10
question
Advanced Placement (AP), 23.11.2020 21:10
Questions on the website: 13722362