Method declares several circle objects

Assignment Help Business Management
Reference no: EM131878765

Please help with the following call using a testcircle.java ? May have to change the original...lost here

a. a class named Circle with fields named radius, diameter, and area. Including a constructor that sets the radius to 1 and calculates the other two values. Also including methods named setRadius()and getRadius(). The setRadius() method not only sets the radius but 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. Using the Math class PI constant for this calculation.) class as Circle.java.

b. a class named TestCircle whose main() method declares several Circle objects. Using the setRadius() method, assign one Circle a small radius value, and assign another a larger radius value. Do not assign a value to the radius of the third circle; instead, retain the value assigned at construction. Displaying all the values for all the Circle objects. Save the application as TestCircle.java.

public class Circle {

public static void main(String[] args);{

 public double radius;

 public double diameter;

 public double area;

 public double circum;

 public Circle() {

  radius = 1.0; 

diameter = 2*radius;

area = Math.PI * radius * radius;

circum = 2 * Math.PI * radius;

 }

 public Circle(double r) {

  radius = r;

diameter = 2*radius;

area = Math.PI * radius * radius;

circum = 2 * Math.PI * radius;

 }

 public void setRadius(double r) {

  radius = r;

diameter = 2*radius;

area = Math.PI * radius * radius;

circum = 2 * Math.PI * radius;

 }

 public double getRadius() {

  return radius;

 }

 public double getArea() {

  return area;

 }

  public double getDiameter() {

  return diameter;

 }

 public double getCircumference() {

  return circum;

 }

 public String toString(){

return "Radius = " + radius +

"nArea = " + area + 

"nCircumference = " + circum;

}

}

Reference no: EM131878765

Questions Cloud

How long must man live so that first option is better deal : The relevant interest rate is 6% per year compounding monthly. How long must the man live so that the first option is a better deal?
What is the nominal interest rate on this loan : What is the effective monthly rate on this loan? what is the nominal (annual) interest rate on this loan?
Describes gaap accounting for this call option : Which of the following accurately describes GAAP accounting for this call option?
Assignment instructions-python : Develop a Python application that incorporates using appropriate data types and provides program output in a logical manner.
Method declares several circle objects : a class named TestCircle whose main() method declares several Circle objects. Using the setRadius() method, assign one Circle a small radius value
Put money in four stocks in dollar amounts indicated : An investor has put money in four stocks in the dollar amounts indicated and with betas specified. What is the portfolio beta?
Demonstrate your understanding of ren and other key concepts : Demonstrate your understanding of Ren and other key concepts of Confucian ethics by choosing one of the following options.
Calculate the genworth ndi for the borrowers : Assignment Certificate IV in Finance and Mortgage Broking - calculate the Genworth NDI for the borrowers. This will require you to enter all the data
Return the price of the product id entered in cell : If true, return an empty text string. If false, return the price of the product ID entered in cell D13.

Reviews

Write a Review

Business Management Questions & Answers

  Calculate the beta for amazon and ford motor company

Download monthly stock prices for the last five years for the Exchange Traded Fund SPDR S&P 500 ETF (Ticker symbol is SPY). Using this as a proxy for the market

  Human resource management practices

What impact does human resource management practices have on employee turnover?

  The shut down rule in the short run

Discuss the shut down rule in the short run.

  Explain the strategic rationale for corporate growth

Using cases and real examples, explain the strategic rationale for corporate growth and the different ways in which companies can achieve such growth. Evaluate the key features of successful strategic entrepreneurship drawing on real cases and exampl..

  Discuss where the company is growing the most

In the cases where the companies has a stronger global footprint (i.e. Ford), discuss where the company is growing the most, what new markets should they consider entering and why, and what markets would you recommend they get out of (if any), and..

  Safe working environment for female employees

What additional steps could you take to assure a safe working environment for female employees?

  Purpose and advantages of conducting a needs assessment

Describe the purpose and advantages of conducting a needs assessment. How does your organization determine training needs?

  Explain ahima data quality management model

Provide examples that illustrate your understanding of data characteristics.

  How does an organization benefit from having a portfolio map

How does an organization benefit from having a portfolio map?

  Organizational variables and organizational motivation

What strategies can leaders use to manage these variables and adjust motivational strategies as needed? Provide examples and rationale to support your opinion.

  Can you have a us management style in the given countries

Can you have a U.S. management style in these countries? In support of your answer, show how various issues would influence the success of multicultural teamwork.

  Explain the common elements of compensation packages

Examine the common elements of compensation packages. Determine which two elements you believe to be the most motivational to an employee and to you. Support your position.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd