Create a class called Circle.java with fields named radius, area, and diameter.  Include methods named setRadius(), getRadius, and computeDiameter(), which calculates the circle's diameter, and computeArea(), which computes the circle's area.  Hint:  diameter of a circle is twice its radius.  Hint:  area of a circle is 3.14 multiplied by the square of the radius. Create a class called TestCircle. java whose main method declares 2 Circle objects.  Using setRadius() method, assign one Circle a small radius value and assign another a larger radius value.  Call computeDiameter() and computeArea for each circle and display the results

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Q2: Create a class called Circle.java with fields named radius, area, and diameter.  Include methods named setRadius(), getRadius, and computeDiameter(), which calculates the circle's diameter, and computeArea(), which computes the circle's area. 

Hint:  diameter of a circle is twice its radius. 
Hint:  area of a circle is 3.14 multiplied by the square of the radius.

Create a class called TestCircle. java whose main method declares 2 Circle objects.  Using setRadius() method, assign one Circle a small radius value and assign another a larger radius value.  Call computeDiameter() and computeArea for each circle and display the results

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT