// // // Prompt meg and let user input 0/1 // 0: read the side of a square and out its area // 1: read the radius and out the area of the circle // import java.util.Scanner; class SquareOrCircle { public static void main(String[] args) { Scanner input = new Scanner(System.in); int choice; double value, area; System.out.print("Input the choice (0/1): "); choice = input.nextInt(); if(choice == 0) { System.out.print("Input the side of the square: "); value = input.nextDouble(); area = value * value; System.out.println("The area of the sqaure is: "+area+"\n\n\n"); } else if(choice == 1) { System.out.print("Input the radius of the circle: "); value = input.nextDouble(); area = 3.14 * value * value; System.out.println("The area of the circle is: "+area+"\n\n\n"); } else { System.out.println("Invalid input.\n\n\n"); } } }