1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
laiz [17]
3 years ago
8

1. Write a toString method for this class. The method should return a string containing the radius and area of the circle.

Computers and Technology
1 answer:
Lady bird [3.3K]3 years ago
6 0

Answer:

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() > getArea())

status = true;

else

status = false;

return status;

}

}

Explanation:

There is nothing with the logic of your code it work fine the problem is with the structure of your code you added an extra  curly brace before declaring (r)

****************************** Am talking about this section **********************

public class Circle {

{

private double radius;

****************************   It should be    *******************************************

public class Circle {

private double radius;

You might be interested in
Which success factor or reward of IS implementation enables you to see the real-time status or availability of a process or prod
trasher [3.6K]

Answer:

efficiency ( A )

Explanation:

Information systems ( IS ) implementation in business helps to create a competitive advantage for the business in the market where its products or services are sold .

A good/successful information system will be bring to light the real time status of a product by showcasing the products efficiency in real time to the potential/ returning customers who needs the product. showcasing the efficiency of a product over another similar products is a very good way to gain a very good advantage over other similar products.

The quality and productivity of the product cannot be affected  via the information systems. while the visibility of the product is done by the marketing department. the information systems give a real time detail of a product mentioning its composition and efficiency in real time.

7 0
4 years ago
Select the correct answer.
melamori03 [73]
B average because he want to estimate how many people were in the meeting
6 0
3 years ago
Start
Crank

Answer:

N=5  key task decision start and end

Explanation:

8 0
3 years ago
How do you take a picture plz answer
Romashka [77]
Hold down Ctrl, Alt, and the button in pointing at for a screenshot to take a picture with the camera. There should be a app on the chrome book in the web store to use.

6 0
3 years ago
Read 2 more answers
What are 2 ways to send a message to your client when signed in as an accountant user?.
7nadin3 [17]

Answer:

The use of Ask client and request are 2 ways to send a message to your client when signed in as an accountant user.

4 0
2 years ago
Other questions:
  • PriQueue inherits from Queue. In the implementation of the getMax() method in the PriQueue class, we need to read and write the
    5·1 answer
  • Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
    6·1 answer
  • Mention<br>any<br>5<br>indicators of<br>happiness​
    11·2 answers
  • Digital Subscriber Line (DSL) is the only Internet connection option available for a small office in the middle of nowhere. Whic
    15·1 answer
  • Jody should select the
    5·1 answer
  • Which factor helps drive globalization?
    9·1 answer
  • As a general rule, what is the size of a brochure?
    11·1 answer
  • In most operating systems what is running application called?
    5·1 answer
  • Use the drop-down menus to complete the statements about printing Contacts. When printing a single contact, go to File and then
    15·1 answer
  • You are network administrator for an Active Directory forest with a single domain. Then network has three sites with one domain
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!