daily pastebin goal
28%
SHARE
TWEET

CSC-111 In class Method Exercise

a guest Oct 27th, 2017 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // In class Method Exercise
  2. // Go here for assignment description:
  3. // http://programmingbydoing.com/a/area-calculator.html
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class AreaCalculator {
  8.  
  9.     public static void main(String[] args) {
  10.         System.out.println("Shape Area Calculator V1.0");
  11.         Scanner input = new Scanner(System.in);
  12.         int option = 0;
  13.         do {
  14.             System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  15.             System.out.println();
  16.             System.out.println("1) Triangle");
  17.             System.out.println("2) Rectangle");
  18.             System.out.println("3) Square");
  19.             System.out.println("4) Circle");
  20.             System.out.println("5) Quit");
  21.             System.out.print("Which shape: ");
  22.             option = input.nextInt();
  23.             input.nextLine();  // Clear Keyboard
  24.             if (option == 1) {
  25.                 System.out.println("You selected Triangle Area Calculation.");
  26.                 System.out.println("Now continue with Area Calculation Logic");
  27.                 System.out.println("...");
  28.             }
  29.             else if (option == 2) {
  30.                 System.out.println("You selected Rectangle Area Calculation.");
  31.                 System.out.println("Now continue with Area Calculation Logic");
  32.                 System.out.println("...");
  33.             }
  34.             else if (option == 3) {
  35.                 System.out.println("You selected Square Area Calculation.");
  36.                 System.out.println("Now continue with Area Calculation Logic");
  37.                 System.out.println("...");
  38.             }
  39.             else if (option == 4) {
  40.                 System.out.println("You selected Circle Area Calculation.");
  41.                 System.out.println("Now continue with Area Calculation Logic");
  42.                 System.out.println("...");
  43.             }
  44.             else if (option != 5) {
  45.                 System.out.println("Illegal Option");
  46.             }
  47.         } while (option != 5);
  48.  
  49.     }
  50.  
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top