-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHome.java
More file actions
73 lines (63 loc) · 2.21 KB
/
Home.java
File metadata and controls
73 lines (63 loc) · 2.21 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import java.sql.SQLException;
import java.util.Scanner;
import DS.*;
public class Home implements ClassSkeleton{
LinkedListPrac<PlayQue> curr_playing = new LinkedListPrac<>();
LinkedListPrac<Integer> pack_chann = new LinkedListPrac<>();
SQLQueries quer;
int id;
String user;
public Home(int id, SQLQueries quer, String user) throws SQLException, ClassNotFoundException {
this.quer = quer;
this.id = id;
this.user = user;
quer.getPackage(id, pack_chann);
}
public void printMenu() {
System.out.println("1) Play TV");
System.out.println("2) Search Channels");
System.out.println("3) Record Shows");
System.out.println("4) Display all available channels");
System.out.println("5) Change Settings");
System.out.println("6) Exit");
}
public void displayAll(Scanner inp) throws SQLException {
curr_playing = quer.AllChannels(pack_chann);
curr_playing.playTV(inp);
}
public void main(Scanner inp, int id) throws SQLException, ClassNotFoundException {
Misc.cls();
System.out.println(Misc.ANSI_GREEN + "Login successfull" + Misc.ANSI_RESET);
int index = 0;
while (index != 6) {
printMenu();
index = Misc.checkInt(inp, "Enter choice: ");
switch (index) {
case 1:
curr_playing.playTV(inp);
break;
case 2:
SearchChannels se = new SearchChannels(quer, pack_chann);
curr_playing = se.main(inp);
break;
case 3:
RecordShow rs = new RecordShow(inp, quer, id);
rs.main();
break;
case 4:
displayAll(inp);
break;
case 5:
Settings st = new Settings(user, id, quer);
st.main(inp);
break;
case 6:
Misc.cls();
break;
default:
System.out.println("Enter correct index!!! ");
break;
}
}
}
}