8000 GitHub - jennathek/30DaysOfJava
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jennathek/30DaysOfJava

Repository files navigation

Calculating Area of Circle


  1. Class Circle

  2. Class Main

    Scanner input = new Scanner(System.in);

    System.out.print("Enter the radius of a circle: ");
    double radius = input.nextDouble();

    input.close();

By creating Scanner object for input, the users can input any radius(datatype double) after they are asked to enter the radius of a circle.

    Circle circle1 = new Circle(radius);
    
    System.out.println("Area is " + circle1.getArea());

This Circle object will pass the radius that user input into the getter(getRadius). And it is going to print the exact Area of the circle since the getter 'getArea' is calculated with the radius that user input.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0