package class3_1_Decisions; // Josiah Yoder, MSOE, 21 September 2015 import javax.swing.*; import java.util.Scanner; public class CircleDecisionsGui { public static void main(String[] args) { // GUI: TO be continued... //final double PI = 3.141592; Scanner in = new Scanner(System.in); JOptionPane.showMessageDialog(null, "Please enter the radius of a circle"); // TODO: How to input a NUMBER with JOptionPane? double radius = in.nextDouble(); String line = JOptionPane.showInputDialog(null, "What do you want to do?\n"+ "To compute the area of the circle, enter a.\n" + "Or, enter c for circumference: "); char c = line.charAt(0); if(c=='a') { double area = Math.PI * radius * radius; JOptionPane.showMessageDialog(null, "The area is: " + area); } else if(c=='c') { double circumference = 2 * Math.PI * radius; JOptionPane.showMessageDialog(null, "The circumference is: " + circumference); } else { JOptionPane.showMessageDialog(null, "Unexpected command: " + c + " Please enter c or a next time."); } JOptionPane.showMessageDialog(null, "Thank you for using this program."); } }