-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathClientForEntertainmentUnitFacade.java
More file actions
50 lines (40 loc) · 1.66 KB
/
ClientForEntertainmentUnitFacade.java
File metadata and controls
50 lines (40 loc) · 1.66 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
42
43
44
45
46
47
48
49
50
package me.premaseem.facade;
import java.util.Scanner;
public class ClientForEntertainmentUnitFacade {
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
int repeatRunFlag = 1;
System.out.println("This is Facade Pattern example which provides a simple interface " +
"for the client to play a movie me entertainment unit " +
"(simplifies the setup process of entertainment unit) ");
EntertainmentFacade entertainmentFacade = new EntertainmentFacade();
while (repeatRunFlag == 1) {
System.out.println("What would you like to do with your entertainment unit today ");
System.out.println(" Press 1 for movie");
System.out.println(" Press 2 for music");
System.out.println(" Press 3 for game ");
int entType = scan.nextInt();
System.out.println("Please enter the name ");
String name = scan.next();
switch (entType) {
case 1:
entertainmentFacade.playMovie(name);
break;
case 2:
entertainmentFacade.playMusic(name);
break;
case 3:
entertainmentFacade.playGame(name);
break;
}
System.out.println("Press 1 for more entertainment and 0 for EXIT .... ");
try {
repeatRunFlag = scan.nextInt();
} catch (Exception e) {
repeatRunFlag = 0;
} finally {
entertainmentFacade.masterPowerOff();
}
}
}
}