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 22:50
Before you enter an intersection on a green light make sure
Answers: 2
question
Computers and Technology, 21.06.2019 23:30
Show that there is a language a ⚆ {0, 1} â— with the following properties: 1. for all x â a, |x| ≤ 5. 2. no dfa with fewer than 9 states recognizes a. hint: you don’t have to define a explicitly; just show that it has to exist. count the number of languages satisfying (1) and the number of dfas satisfying (2), and argue that there aren’t enough dfas to recognize all those languages. to count the number of languages satisfying (1), think about writing down all the strings of length at most 5, and then to define such a language, you have to make a binary decision for each string about whether to include it in the language or not. how many ways are there to make these choices? to count the number of dfas satisfying (2), consider that a dfa behaves identically even if you rename all the states, so you can assume without loss of generality that any dfa with k states has the state set {q1, q2, . . , qk}. now think about how to count how many ways there are to choose the other four parts of the dfa.
Answers: 3
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
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