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
Yakvenalex [24]
3 years ago
9

Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes

an initial value for the radius, get and set methods for the radius, and methods getArea and getPerimeter.
Computers and Technology
1 answer:
Mrrafil [7]3 years ago
4 0

public class Circle {

// the private data members

private double radius;

private double area;

private double diameter;

public void setRadius(double r)

{

 radius = r;

}

public double getRadius()

{

 return radius;

}

public double computeDiameter()

{

 return radius * 2;

}

public double computeArea()

{

 return ((radius * radius) * 3.14);

}

}

You might be interested in
Which of the following method calls are legal?a. mathMethod(x);b. mathMethod(y);c. mathMethod(x, y);d. mathMethod(x + y);e. math
Roman55 [17]

Answer:

Option a, b, d, f, and j is legal method calls.

Explanation:

In the given question some information is missing, that is the method definition which can be described as follows:

Method definition:

int x =2, y=3; //defining integer variable

int mathMethod (int x)  //method definition

{//method body

int z=x+y; //calculate value

return z;  //return value

}

In the given question option a, b, d, f, and j  is legal, because these options follow the correct syntax, and other option were incorrect which can be defined as follows:

  • In option c, It is illegal because it accepts only one parameter.
  • In option e, It is accepts long number, that's why it is illegal.
  • In option g, It accepts float value, that's why it is illegal.
  • In option h, It doesn't accepts any parameter.
  • In option i, It isn't use in method.
7 0
3 years ago
If you want to find out the specific questions you answered incorrectly on a particular examination, what option on the Web site
Greeley [361]
There is not necessarily one site we can all go to and get any answers we want, trust me I been trying to find a site that does that but, if you want your questions answered post it on this site.
7 0
3 years ago
Assume that the array arr has been declared . Write a statement that assigns the next to last element of the array to the variab
iris [78.8K]

Answer:

x=arr[arr.length-2]; is the correct answer for the given question.  

Explanation:

In the above statement firstly we calculate the length of the given array.The arr.length function is used to calculate the array length.As mention in the question we have to assign the next to last element of the array to the variable x, so we used arr[arr.length-2] and finally, we assign them to the variable x.

so the final statement is x=arr[arr.length-2];

6 0
3 years ago
Write a program that converts a decimal height in feet into feet and inches.
Naily [24]

The program to illustrate the conversion of the height is illustrated below.

<h3>How to illustrate the program?</h3>

The information here is to convert 1 inch = 2.54 cm. First, we will take user input of height in cm. We first convert this to inches by dividing by 2.54

After that, we use Floor Division // and Modulo % by 12 to get feet and inches respectively.

The inches will be in a lot of decimals. We round this off to 2 decimal places and finally print out the converted height.

The code will be:

# Take user input for height in cm

height_cm = float(input("Enter your height in cm: "))

# Convert height to inches

height_in = height_cm / 2.54

# Get feet by taking floor division with 12

feet = height_in // 12

# Get inches by taking modulo division with 12

inches = height_in % 12

# Round off the inches to 2 decimal places

inches_rounded = format(inches, ".2f")

# Print out the height in feet and inches

print(f"Height is {feet} ft {inches_rounded} in")

Learn more about program on:

brainly.com/question/26134656

#SPJ1

4 0
1 year ago
What is the output of the code below?
sp2606 [1]

Answer:

The output of the given code is 56.43

Explanation:

As the code is given in java language the following are the code

public class code

{

public static void main(String[] args)

{

double num = 56.4321;

System.out.print("%.2f", 56.4321);

}

}

The %f means that it print the floating point number and .2 means that it print the first two digit of the given number after the point .

so " %.2f "means that it print the value first 2 digit of floating point number after the point .

Therefore it print 56.43

7 0
3 years ago
Other questions:
  • What do you observe on the filter paper strip after 2 to 3 hours?
    8·2 answers
  • Who is responsible for customer service?
    14·1 answer
  • In Vista and Windows 7, the Appearance and Personalization option allows you to change the
    14·1 answer
  • To check spelling errors in a document, the Word application uses the _____ to determine appropriate spelling. Internet built-in
    5·2 answers
  • Backing up and synchronization are the same thing. <br><br>A.)True<br>B.) False​
    7·1 answer
  • In client server network, there is no central server //// true or false​
    8·1 answer
  • Which key should you press and hold to select multiple cells?
    8·2 answers
  • What security weaknesses/vulnerabilities exist in Wireless local area network device hardware and software?
    10·1 answer
  • When viewing an e-book section of an assignment in launchpad, you can return to your main course page at any time by clicking th
    5·1 answer
  • When a linked chain contains nodes that reference both the next node and the previous node, it is called a(n)?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!