Instantiate a circle by giving its radius and use

Assignment Help JAVA Programming
Reference no: EM13876421

Write a class Circle.java from which we can instantiate a circle by giving

its radius and use it as is shown in the following program.

1 import java.util.Scanner;

2 public class Circles {

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

4 Scanner input = new Scanner(System.in);

5 System.out.print("Enter radius: ");

6 double radius = input.nextDouble();

7 input.close();

8 Circle myCircle = new Circle(radius);

9 double area = myCircle.getArea();

10 double perimeter = myCircle.getCircumference();

11 System.out.printf("Area: %.2f, Perimeter: %.2fn", area,

perimeter);

12 }

Reference no: EM13876421

Questions Cloud

Write a java program that stores these integers : 3. Write a java program that stores these integers 10, 20, 30, 40, 20 in an array named nums. Write the code to count all the occurrences of 20 and then display the count.
Define and discuss the concepts of risk and return : Define and discuss the concepts of risk and return. Also discuss the importance of portfolio diversification and its relationship to risk and return.
The class date was designed and implemented : In Programming Exercise 2, the class Date was designed and implemented to keep track of a date, but it has very limited operations. Redefine the class date so that, it addition to the operations already defined, it can perform the following operation..
Compute the adequate positions in the hedging instruments : You currently hold a 7-year fixed rate bond 5% annually. You would like to hedge against changes in the level and the slope of the yield curve and you plan to use a 1-year zero coupon bond and a 7-year zero coupon bond. Use the following table to com..
Instantiate a circle by giving its radius and use : Write a class Circle.java from which we can instantiate a circle by giving its radius and use it as is shown in the following program. 1 import java.util.Scanner; 2 public class Circles {
Old manufacturing equipment with an annual depreciation : Refer to the data in Problem. Estimate the cash from operations expected in year 2.In Problem, Cameron Parts has the following data from year 1 operations, which are to be used for developing year 2 budget estimates:
Eoq model- very large increase in sales will result : According to the EOQ model, a very large increase in sales will result in
An n n matrix is called a positive markov matrix : An n n matrix is called a positive Markov matrix if each element is positive and the sum of the elements in each column is 1. Write a program MarkovMatrix.java that prompts the user to enter a 33 matrix of double values. Use a method with the followi..
Generates after-tax cash flows : An investment of $83 generates after-tax cash flows of $46.00 in Year 1, $70.00 in Year 2, and $131.00 in Year 3. The required rate of return is 20 percent. The net present value is

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  A uml activity diagram that illustrates how program works

Create a UML activity diagram that illustrates how your program works. Your diagram must include all the data items in your program.

  Write a program that presents an animated graphical model

Write a program that presents an animated graphical model of an elevator, that has at least four floors, with doors that open and close, and some indication that shows the car moving.

  Can linear search algorithm be encoded using recursion

Determine the average amount of time people spend waiting for tables and provide examples from the "real world" of unsorted lists, sorted lists, indexed lists, lists that permit duplicate elements, and lists that do not permit duplicate elements

  How can i support https in a servlet

1) What is SSL? 2) How can I support HTTPS (SSL) in a servlet? 3) How can I download a file (for instance, a Microsoft Word document) from a server using a servlet and an applet?

  Prepare a program for sorted list

Code a doubly links, sorted list (in ascending order). Each item of the list will just store int. You need to code three classes: Node, SortedList, and GroupProject

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

  Create a new project in bluej by clicking on the menu option

Create a new project in BlueJ by clicking on the menu option Project > New project. This will create a folder with the project name (see below). All BlueJ project-related files for this project will be stored in this folder. Create new classes by ..

  Write a program that creates two string arrays

Write a program that creates two String arrays, one to store names of 5 boys and another to store names of 5 girls

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Construct a huffman code tree

Draw the tree that would be formed by inserting the words in this question into a binary search tree and construct a Huffman code tree. Show the initial priority queue and all changes in its state as the tree is constructed.

  Need a console program

Need a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed).

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