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 are guidlines for using themes? Check all that apply
Andreyy89

Answer: A. Using different cell styles can help you differentiate different types of data.

B. Fonts should be easily readable and of appropriate size.

D. Be consistent with themes across worksheets and workbooks.

Explanation:

A theme refers to the preset package that contains functionality details and graphical appearance.

The guidelines for using themes include:

• Using different cell styles can help you differentiate different types of data.

• Fonts should be easily readable and of appropriate size.

• Be consistent with themes across worksheets and workbooks.

Therefore, the correct options are A, B and D.

7 0
3 years ago
What would you need to have on your foley stage
LUCKY_DIMON [66]
<span>You will need many props for your Specific tracks (whatever you see in the film!). It's impossible to say what you will need until you see the picture and as time goes by you will add to your collection (if you have space!) - garbage day in my neighborhood is 'golden day' as I collect some of best props from the stuff people throw out: old bicycles, doors, sinks, wood, metal, desks, etc.</span>
4 0
3 years ago
Which of the following is an example of Boolean operator?
Paraphin [41]

Answer:

BUT APEX Verified

Explanation:

7 0
3 years ago
Read 2 more answers
Bluetooth 5 allows data to be transferred between two devices at a rate of
Minchanka [31]

Answer:

2 MBPS.

Explanation:

The Bluetooth 5 raises the data transmission of information throughput from 1 Mbps to the 2 Mbps. The main advantage of Bluetooth 5 do not increasing the energy  utilization.The Bluetooth 5 increasing the volume of information that technologies can be distribute.

  • The main advantage of Bluetooth 5 decreases the time it would take to send and receive the signals,
  • The previous version of Bluetooth transmit the information from one device to the another with the 1 Mbps speed  .
7 0
3 years ago
Normally you depend on the JVM to perform garbage collection automatically. However, you can explicitly use ________ to request
Naddik [55]

Answer:

System.gc()

Explanation:

System.gc() can be defined as the method which can be used to effectively request for garbage collection because they runs the garbage collector, which in turn enables JMV which is fully known as JAVA VIRTUAL MACHINE to claim back the already unused memory space of the objects that was discarded for quick reuse of the memory space , although Java virtual machine often perform garbage collection automatically.

7 0
3 years ago
Other questions:
  • Hi, I have several computer questions. These refer to the history of the internet. I would like to know if everything we look fo
    12·1 answer
  • What type of socket should be used with an air impact wrench
    12·1 answer
  • URGENT!
    15·1 answer
  • Could this be restored? And is it worth the money it’d take?
    9·2 answers
  • Three variables, x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts th
    13·2 answers
  • Click this link to view O NET'S Wages and Employment section for Film and Video Editors.
    11·2 answers
  • Match the elements of a web page with their descriptions.
    12·1 answer
  • LCD, EL and gas-plasma are types of flat-panel screens.<br> True<br> False
    13·1 answer
  • (True or False) The speed at which data travels on a bus is referred to as the word size.
    6·2 answers
  • Hexadecimal to denary gcse method
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!