Skip to content

First full program - calculate area and circumference of a circle using an input

Notifications You must be signed in to change notification settings

addiedavis/area-and-circumference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

area-and-circumference

First full program - calculate area and circumference of a circle using an input

The program attached Circle-test.java is written out below:

package edu.cscc; import java.util.Scanner;

// Adeline Davis - Calculate a circle's area and circumference

public class Main {

private static Scanner input = new Scanner(System.in);

public static void main(String[] args) {
    double radius;
    double area;
    double perimeter;

    Scanner userInput = new Scanner (System.in);
    String name = "";
        System.out.print("Please enter a radius.");
        radius = input.nextDouble();
        area = Math.PI * radius * radius;
        System.out.println("The area of a circle with a radius of " + radius + " is " + area);
        perimeter = 2 * Math.PI * radius;
        System.out.println("The circumference of a circle with a radius of " + radius + " is " + perimeter);
    }
}

About

First full program - calculate area and circumference of a circle using an input

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages