package class3_3_Loop_start; // Josiah Yoder, MSOE, 21 September 2015 import java.util.Scanner; public class CircleDecisions { public static void main(String[] args) { //final double PI = 3.141592; Scanner in = new Scanner(System.in); System.out.println("Please enter the radius of a circle"); double radius = in.nextDouble(); System.out.print("What do you want to do?"); System.out.print("To compute the area of the circle, enter \"a\".\n" + "Or, enter \"c\" for circumference: "); String line = in.nextLine(); char c = line.charAt(0); if(c=='a') { double area = Math.PI * radius * radius; System.out.println("The area is: "+area); } else if(c=='c') { double circumference = 2 * Math.PI * radius; System.out.println("The circumference is: "+circumference); } else { System.out.println("Unexpected command: "+c+" Please enter \"a\" or \"c\" next time."); } System.out.println("Thank you for using this program."); } }