Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     /**
  6.      * @param args the command line arguments
  7.      */
  8.     public static void main(String[] args) {
  9.  
  10.         Scanner input = new Scanner(System.in);
  11.         String choice;
  12.         do {
  13.             System.out.println("\n" + "Chose a shape or type exit to quit the program");
  14.             System.out.println("What geometric shape do you want to use?");
  15.  
  16.             choice = input.next();
  17.             if (choice.equals("circle")) {
  18.                 Circle circle = new Circle();
  19.  
  20.             } else if (choice.equals("rectangle")) {
  21.                 Rectangle rectangle = new Rectangle();
  22.             }
  23.             else {
  24.                 System.out.println("\n" + "Invalid choice.");
  25.             }
  26.  
  27.         } while (!choice.equals("exit"));
  28.         input.close();
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement