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
Svet_ta [14]
3 years ago
3

How to do simple class Circle with one field radius.Supply one constructor that makes the radius of the circle as a parameter.Su

pply one method getArea ,that computes and returns (not prints)the area of a circle.Provide the accessor method getRadius.How to create a small class CircleTest with a main method that prompts the user to enter an integer value for the radius,creates one Circle object with that radius,calls it getArea method,and prints out the returned value.
Computers and Technology
1 answer:
Kitty [74]3 years ago
3 0

Answer:

import java.util.Scanner;

public class Circle {

   private double radius;

   //The constructor

   public Circle(){

       

   }

   //Method to compute and return the area

   public double getArea(double radius){

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

       return area;

   }

   //Accesor method (getRadius)

   public double getRadius() {

       return radius;

   }

}

class CircleTest{

   //The main method

   public static void main(String[] args) {

       //Scanner Class to receive user input

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Radius");

       double r = in.nextDouble();

       //Make an instance of the class Circle

       Circle circle = new Circle();

       //Calculating the area

       double calArea = circle.getArea(r);

       //Printing out the area

       System.out.println("The area is: "+calArea);

   }

}

Explanation:

  • This has been solved with Java Programming Language
  • Please follow the comments in the codes
  • As required, The class Circle is created with one member variable radius
  • A getter method is also created
  • A method getArea is also created that computes and returns the area of the circle
  • In the class CircleTest The scanner class is used to receive a user value for radius
  • An instance of Circle class is created
  • The method getArea is called with the instance of the class
  • The area is printed out
You might be interested in
3. A hyperlink is important because it allows you to ___________. (1 point) click on the link to go directly to a website insert
ikadub [295]
A hyperlink is a link that can direct a person to another website when clicked. So the answer would click on the link to go directly to a website. To insert an image or sound you would use something else. And a hyperlink doesn't restrict a person to just the publisher information. I hope this helps!
3 0
3 years ago
The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the own
Reptile [31]

Answer:

Explanation:

def octal_to_string(octal):

   result = ''

   value_letters = [(4, 'r'), (2, 'w'), (1, 'x')]

   for c in [int(n) for n in str(octal)]:

       for value, letter in value_letters:

           if c >= value:

               result += letter

               c -= value

           else:

               result += '-'

   return result

print(octal_to_string(755))

print(octal_to_string(644))

print(octal_to_string(750))

print(octal_to_string(600))

**************************************************

7 0
4 years ago
A(n) ____________________ can improve system performance when two devices have different data transfer rates, as when copying mu
defon

Hello there

the answer to the question is

<u><em>Buffer</em></u>

hope this helps

Best Regards Queen Z

8 0
3 years ago
True or false
ICE Princess25 [194]
1. True
2. Usually true, but it depends on the search engine you're using.  For example, Google lets you search for several words without commas.
3 0
3 years ago
Here is the list of problems to choose from:
olya-2409 [2.1K]

Answer:

There's a parking lot that is 600m² big. The lot must be able to hold at least 3 buses and 10 cars.

Each car takes up 6m² and each bus takes up 30m².

However, there can only be 60 vehicles in the lot at any given time.

The cost to park in the lot is $2.50 per day for cars and $7.50 per day for buses. The lot must make at least $75 each day to break even.

What is a possible car to bus ratio that would allow the lot to make profit?

3 0
3 years ago
Other questions:
  • Most panoramic photography focuses on what subject?
    9·2 answers
  • The technology that identifies people through bodily characteristics is known as
    10·1 answer
  • You have no control over who views your social network information
    13·2 answers
  • What is a tag in an HTML document?
    5·1 answer
  • A graph of an organization'snet income over the past 10 years is an example of an analogmodel.
    7·1 answer
  • 1. when is it a good idea to use lossless compression
    8·1 answer
  • Rey is recording the dialogues and sound effects separately in the studio, as he is not happy with the sound quality recorded on
    9·1 answer
  • What is a good starting point for data mining?
    5·1 answer
  • Although it is not a term Excel uses, how do most people think of Excel?
    13·1 answer
  • What do the Brainly points do? sorry im new here and i dont know how to internet rn .-.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!