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, 21.06.2019 17:30
How are natural numbers, whole numbers, integers, and rational numbers related
Answers: 3
question
Computers and Technology, 22.06.2019 06:30
What result from the passage of this amendment
Answers: 1
question
Computers and Technology, 22.06.2019 08:00
What is the algorithm for building a binary tree program
Answers: 2
question
Computers and Technology, 22.06.2019 10:30
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
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
Questions on the website: 13722362