{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CircleTester - System.out.printf"Circumference...

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

View Full Document Right Arrow Icon
import java.util.Scanner; public class CircleTester { //main method public static void main(String[] args) { Scanner input = new Scanner (System.in); //prompt user to enter colour System.out.println("Enter a colour"); //declare vairable colour String colour = input.next(); //create a circle object with radius = 1.0 Circle circle1 = new Circle(1.0); //declare local variable c to store circumference double c = circle1.getCircum(); //print out c
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.printf("Circumference = %5.3f", c); //declare local variable a to store area double a = circle1.calcArea(); //print out a System.out.printf("\nArea=%5.3f", a); //print out colour System.out.print("\nColour=" + colour); //Change the radius circle1.radius=3.5; //declare local variable r to store the radius double r = circle1.radius; //print out radius System.out.print("\nRadius=" + r); } //end of main }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online