Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Eva Goins
- * Chapter 6
- * Description: Utilizes class Circle to create a circle. Gets
- * user input for the circle radius in order to use methods
- * getArea, getDiameter, and getCircumference to calculate
- * the area, diameter, and circumference respectively.
- * Displays the area, diameter, and circumference after
- * calculating.
- */
- import java.util.Scanner;
- public class Program7CircleClass
- {
- public static void main(String[] args)
- {
- Scanner keyin = new Scanner(System.in);
- Circle myCircle = new Circle();
- double rad;
- System.out.print("Input a radius: ");
- rad = keyin.nextDouble();
- myCircle.setRadius(rad);
- System.out.printf("The area is %.2f \n", myCircle.getArea());
- System.out.printf("The diameter is %.2f \n", myCircle.getDiameter());
- System.out.printf("The circumference is %.2f \n",
- myCircle.getCircumference());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement