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
A cpu with an external clock speed of 2 ghz and a 64-bit data bus can (theoretically) transfer how much data per second?
GREYUIT [131]
The CPU could cycle the bits 2000000000 a second. That means theoretically it could process 16 gigabytes of data a second.
5 0
3 years ago
Which storage is faster than secondary storage​
kozerog [31]

Answer:

RAM provides much faster accessing speed to data than secondary memory. By loading software programs and required files into primary memory(RAM), computer can process data much more quickly. Secondary Memory is slower in data accessing. Typically primary memory is six times faster than the secondary memory.22-Aug-2019

5 0
2 years ago
Read 2 more answers
What is the output of the following C++ program?
KIM [24]

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

3 0
3 years ago
Carly is part of a community of developers. In her free time, she works on code to improve this open-source operating system. Th
mina [271]

Answer:

The answer to this question is given below in the explanation section.

Explanation

Carly is part of a community of developers. In her free time, she works on code to improve this open-source operating system. The OS she's working on is most likely are:

  1. Linux
  2. OpenBSD
  3. FreeBSD
  4. NetBSD
  5. AROS
  6. Tock
  7. FreeDOS
  8. Dragonfly BSD
  9. Qubes OS
  10. Haiku
  11. Redox
  12. ReactOS
  13. Subgraph OS
  14. osv.io
  15. ToaruOS
  16. Mezzano
  17. House
  18. Minoca OS
  19. SOS
  20. PowerNex
  21. Interim OS
  22. KolibriOS
  23. MINIX
  24. HelenOS
  25. Sculpt
  26. Harvey
  27. illumos
  28. GeckOS/A65 V2.0
  29. Serenity
  30. GNU Hurd
  31. Plan 9
  32. AquilaOS
  33. Biscuit
  34. Xv6

These are the different opensource operating systems.

3 0
3 years ago
Java can be procedural or object-oriented when it comes to programming. What is the difference between procedural and OOP?​
Helen [10]

Answer:

Procedural Programming => Functions

Object-Oriented Programming => Classes

Explanation:

Procedural programming is essentially what it sounds like – it's a series of procedures that the computer executes out. A procedure is essentially a function built of different steps that you the coder have grouped as such.

Object-Oriented Programming is all about objects. Objects contain data in the form of attributes, and functions in the form of methods. The most popular Object-Oriented Programming languages are class based, meaning that each object is an instance of a class (the class being a template).

Hope that helps! And you can always research more online!

7 0
3 years ago
Other questions:
  • Ryan is looking at investment opportunities as a cloud service provider. He wants to invest in a deployment-based cloud model th
    11·2 answers
  • Help me Please?!! I will put you as brainliest.<br>I hope I spelled that right.
    5·2 answers
  • To copy the formatting of one control to other controls, use the ____ button on the form design tools format tab.
    7·1 answer
  • If you decide to get married, a trade-off would be that you have to give up being single.
    12·2 answers
  • Where can you find your EFC
    8·2 answers
  • What in the LAN for a small office, some user devices connect to the LAN using a cable, while others connect using wireless tech
    14·1 answer
  • Which of the following are mass communication methods? (Select all that apply.)
    9·1 answer
  • Recall that in C++ there is no check on an array index out of bounds. However, during program execution, an array index out of b
    9·1 answer
  • I really need this done Thank you!!
    6·1 answer
  • HELLLLLLLLPPPPPPPPPPPP HHHHHHHHHEEEEEEEEELLLLLLPPPPPP MEEEEEEEE
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!