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
When you schedule an appointment, Outlook adds the appointment to the ____ folder by default.
Elis [28]
D is the correct answer! :)
8 0
3 years ago
Should spreadsheets be used to maintain a checkbook?<br> YES<br><br> NO
algol [13]

Yes, because it keeps all your data organized and allows you to see the trend and growth of your data by automatically creating different types of charts and graphs to help you visualize your data.

Hope that helps!

7 0
2 years ago
When using overloaded functions in appication code, the compiler will call which one
musickatia [10]

Answer:

The function with same name,same number and type of arguments.

Explanation:

Function overloading occurs when the functions with same name in the same scope with the same return type but different argument numbers and different argument types.So when we want to call a specific function we have to pass the same number of arguments with same type of arguments.We can do function overloading for the functions with same return type only.

7 0
4 years ago
Question # 3
Contact [7]

Answer:

The answer is >

Explanation:

I did the assignment on edge this was the correct answer

5 0
3 years ago
Read 2 more answers
Input 3 positive integers from the terminal, determine if tlrey are valid sides of a triangle. If the sides do form a valid tria
butalik [34]

Answer:

In Python:

side1 = float(input("Side 1: "))

side2 = float(input("Side 2: "))

side3 = float(input("Side 3: "))

if side1>0 and side2>0 and side3>0:

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

       if side1 == side2 == side3:

           print("Equilateral Triangle")

       elif side1 == side2 or side1 == side3 or side2 == side3:

           print("Isosceles Triangle")

       else:

           print("Scalene Triangle")

   else:

       print("Invalid Triangle")

else:

   print("Invalid Triangle")

Explanation:

The next three lines get the input of the sides of the triangle

<em>side1 = float(input("Side 1: ")) </em>

<em>side2 = float(input("Side 2: ")) </em>

<em>side3 = float(input("Side 3: ")) </em>

If all sides are positive

if side1>0 and side2>0 and side3>0:

Check if the sides are valid using the following condition

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

Check if the triangle is equilateral

<em>        if side1 == side2 == side3: </em>

<em>            print("Equilateral Triangle") </em>

Check if the triangle is isosceles

<em>        elif side1 == side2 or side1 == side3 or side2 == side3: </em>

<em>            print("Isosceles Triangle") </em>

Otherwise, it is scalene

<em>        else: </em>

<em>            print("Scalene Triangle") </em>

Print invalid, if the sides do not make a valid triangle

<em>    else: </em>

<em>        print("Invalid Triangle") </em>

Print invalid, if the any of the sides are negative

<em>else: </em>

<em>    print("Invalid Triangle")</em>

4 0
3 years ago
Other questions:
  • Write a program whose input is two integers and whose output is the two integers swapped. Place the values in an array, where x
    12·1 answer
  • SecOps focuses on integrating the need for the development team to provide iterative and rapid improvements to system functional
    11·1 answer
  • What is the prediction in technology for the future?
    6·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 then the outp
    12·1 answer
  • N, or central processing unit, is also known as the
    10·2 answers
  • Analyze the following recursive method and indicate which of the following will be true.
    7·1 answer
  • Codehs dartboard 3.12.4
    9·1 answer
  • After Sally adds the Print Preview and Print command to the Quick Access Toolbar, which icon would she have added? the icon that
    6·2 answers
  • Help ASAP please This is a skills lab simulation for college, it’s on Microsoft word is there a keyboard shortcut or something o
    12·1 answer
  • For a single CPU core system equipped wiith addditional hardware modes (besides user and kernel), choose those items that are ex
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!