-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskSwitcher.java
More file actions
41 lines (36 loc) · 1.19 KB
/
TaskSwitcher.java
File metadata and controls
41 lines (36 loc) · 1.19 KB
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
package com.lftechnology.runner;
import com.lftechnology.programs.MultiplierProgram;
import com.lftechnology.programs.PalindromeProgram;
import com.lftechnology.programs.SalutationProgram;
public class TaskSwitcher {
protected int chosenOption;
public TaskSwitcher(int option) {
this.chosenOption = option;
}
public void switchAndRun() {
Menu menu = new Menu();
switch (this.chosenOption) {
case 1:
SalutationProgram salutationProgram = new SalutationProgram();
salutationProgram.run();
break;
case 2:
MultiplierProgram multiplierProgram = new MultiplierProgram();
multiplierProgram.run();
break;
case 3:
PalindromeProgram palindromeProgram = new PalindromeProgram();
palindromeProgram.run();
break;
case 0:
System.out.println("->You are exiting the program now...");
System.out.println("->Exited");
System.exit(0);
default:
System.out.println("->Invalid Input");
System.out.println("\n");
menu.showmenu();
}
menu.showmenu();
}
}