summaryrefslogtreecommitdiff
path: root/src/App.java
blob: cc709394e449b96e72d27d0e67b796c9ad21ca49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ca.mokhan.comp268;

import Q1.*;
import java.util.Scanner;

public class App {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    Integer selection = args.length > 0 ? Integer.parseInt(args[0]) : null;

    while (true) {
      if (selection == null) {
        System.out.println("Choose exercise: (1-10)");
        selection = in.nextInt();
      }
      switch (selection) {
        case 1:
          Q1.ReversedSentence.main(args);
          break;
        case 2:
          Q2.RockPaperScissorsLizardSpock.main(args);
          break;
        case 3:
          Q3.CreditCard.main(args);
          break;
        case 4:
          Q4.RandomSumGame.main(args);
          break;
        case 5:
          Q5.Village.main(args);
          break;
        case 6:
          Q6.WeekDay.main(args);
          break;
        case 7:
          Q7.Person.main(args);
          break;
        default:
          System.out.println("Bye");
          System.exit(0);
          break;
      }
      selection = null;
    }
  }
}