Circle - /* / Circle.java / / Print the area of a circle...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//********************************************************** // Circle.java // // Print the area of a circle with two different radii //********************************************************** import java.util.Scanner; public class Circle { public static void main(String[] args) { final double PI = 3.14159; int radius; double area1, area2; double circumference1, circumference2; Scanner scan = new Scanner(System.in); // Prompt for and read in the radius System.out.print ("Please enter a value for the radius: "); radius = scan.nextInt(); // Calculate area and circumference and print the results area1 = PI * radius * radius; circumference1 = 2 * PI * radius; System.out.println("The area of a circle with radius " + radius +
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Ask a homework question - tutors are online