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
Lunna [17]
3 years ago
7

Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and ca

lculates the other two values. Also include methods named setRadius() and getRadius(). The setRadius() method not only sets the radius, but it also calculates the other two values. (The diameter of a circle is twice the radius, and the area of a circle is pi multiplied by the square of the radius. Use the Math class PI constant for this calculation.) Save the class as Circle.java.
Computers and Technology
1 answer:
REY [17]3 years ago
6 0

Answer:

The code for this class is shown in the explanation section

Explanation:

public class Circle {

   private double radius;

   private double diameter;

   private double area;

   public Circle(double radius, double diameter, double area) {

       this.radius = 1;

       this.diameter = diameter;

       this.area = area;

   }

   public void setRadius(double radius) {

       this.radius = radius;

       diameter = radius*2;

       area= Math.PI*(radius*radius);

   }

   public double getRadius() {

       return radius;

   }

}

You might be interested in
What modifier should you use on the members of a class so that they are not accessible to another class in a different package,
vova2212 [387]

The private modifier specifies that only other members of the same class can access the member. The protected modifier restricts access to the member to within its own package.

<h3>What are public and private modifiers?</h3>

The public access modifier permits code from both inside and outside the class to access the class's methods and properties, whereas the private modifier prevents outside code from accessing the class's methods and properties.

Thus, private modifier is the member.

For more details about private modifier, click here

brainly.com/question/15108837

#SPJ1

5 0
2 years ago
Information that's been collected to help solve a problem is called
Butoxors [25]

Answer:

Data is the correct answer

5 0
3 years ago
The default page orientation in a microsoft excel worksheet is landscape true false
kobusy [5.1K]
To answer your question it is false. This is because excels default orientation is portrait
6 0
3 years ago
What is the meaning of the FN key and what is its Function
nevsk [136]

fn is to talk to the computer

7 0
3 years ago
Please help! No one is answering these correctly!
nataly862011 [7]

Answer:

it is either c or d

I'm 99.5% sure it is C tho

8 0
3 years ago
Other questions:
  • Javascript or java? which one is better?
    13·2 answers
  • Which of the following operations would best allow you to place 3D building models at their proper height on the terrain (e.g.,
    8·1 answer
  • The camera on a phone or laptop can be used to track a user's eye movements. Which of these is NOT one of the possible applicati
    13·1 answer
  • ______ is using material created by others without obtaining permission from the original authors.
    10·2 answers
  • SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater th
    14·1 answer
  • 20 points
    7·1 answer
  • in the world of computing accessibilty most often refers to: a how quickly software opens , b password protection, c assistance
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • Discussion Topic
    8·1 answer
  • In this lab, you complete a C++ program that uses an array to store data for the village of Marengo.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!