SHORT ANSwER. write the word or that best completes each statement or answers th
ID: 3793002 • Letter: S
Question
SHORT ANSwER. write the word or that best completes each statement or answers the question phrase 11) Consider the following class declaration: public class Circle private double radius; public Circle(double r) public double getArea0 return Math PI radius radius; public double getRadius0 return radius; a. write toString method for this class. The method should return a string containing the radius and area of the circle. C) Public sting to radius t Math.PI Andi area return ou9Pvuf b. 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. luc Sv vla an false AreaExplanation / Answer
41
A)
public String toString(){
return "Radius: "+radius+" Area: "+getArea();
}
B)
public boolean equals(Object obj){
if(obj==this)
return true;
if (obj==null || obj.getClass()!=this.getClass())
return false;
Circle other=(Circle)obj;
return radius==other.radius;
}
C)
public boolean greaterThan(Circle obj){
return this.getArea()<obj.getArea();
}
42.
A)
POODLE
BOXER
TERRIER
B)
0
1
2
C)
BOXERis not greater thanTERRIER
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.