-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovieTickets.dart
More file actions
148 lines (135 loc) · 4.11 KB
/
movieTickets.dart
File metadata and controls
148 lines (135 loc) · 4.11 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//For teachers
import 'dart:io';
class MovieTicket {
late int key;
late String name; //last name of teacher
late int quantity; //Qualification of teacher
late String movieName; //Experiance of the person
late int choice;
var movieList = [];
// Starter menu
void bankMenu() {
print("************Movies List Menu*************");
print("************Bollywood*************");
print("1:KGF2.");
print("2:DHOOM4.");
print("3:BAAGHI.");
print("4:BAAGHI2.");
print("5:AVATAR.");
print("6:V.");
print("************Menu*************");
print("1:Create a new entry.");
print("2:Update the existing entry by id");
print("3:Delete the entry.");
print("4:For showing the specific movie here...");
print("5:Display All Records here...");
print("6:For exit...");
}
// user choice here...
// get the user choice here...
void userChoice() {
print("Enter Your choice here...");
choice = int.parse(stdin.readLineSync()!);
}
// if the user choice 1
// Opening the new account process is given below!
void OpenAccount() {
print("Enter the id here...");
key = int.parse(stdin.readLineSync()!);
print("Enter the first name...");
name = stdin.readLineSync()!;
print("Enter the Movie name...");
movieName = stdin.readLineSync()!;
movieList.add(
{
"id": key,
"user_name": name,
"movie_name": movieName,
},
);
print(movieList);
}
// insert new entry here...
void editEntry() {
print("Please ! Enter your account id for editing");
var checkID = int.parse(stdin.readLineSync()!);
for (var i = 0; i < movieList.length; i++) {
if (checkID == movieList[i]['id']) {
print("Enter the name here for changing");
var name = stdin.readLineSync()!;
print("Enter the movie name here for changing");
var movieName = stdin.readLineSync()!;
movieList[i]['name'] = movieList[i]['name'] = name;
movieList[i]['movie_name'] = movieList[i]['movie_name'] = movieName;
print(movieList[i]);
return;
}
}
}
// for deleting here...
void deleteExistingAccount() {
print("Please Enter your account id for debiting");
var checkID = int.parse(stdin.readLineSync()!);
for (var i = 0; i < movieList.length; i++) {
if (checkID == movieList[i]['id']) {
print("R u agreed for deleting ? say 1 for yes say 0 for no");
var isDelete = int.parse(stdin.readLineSync()!);
if (isDelete == 1) {
print('WE are deleting this from database');
movieList.removeWhere((element) => element["id"] == checkID);
} else {
print("Okk not deleting");
}
}
}
}
//for showing all the data of the list here..
void checkAccountDetails() {
print("Please Enter your account id for debiting");
var checkID = int.parse(stdin.readLineSync()!);
for (var i = 0; i < movieList.length; i++) {
if (checkID == movieList[i]['id']) {
if (checkID == movieList[i]['id']) {
print("Your Account Detail");
print("Your Account name");
print(movieList[i]['name']);
print("Your Account id");
print(movieList[i]['id']);
print("Your Salary");
print(movieList[i]['movie_name']);
}
}
}
}
void showAllData() {
print("***********All Selected or Cart list**************");
print(movieList);
}
// initial starter of the program here...
void start() {
do {
// because we need this
bankMenu();
userChoice();
switch (choice) {
case 1:
OpenAccount();
break;
case 2:
editEntry();
break;
case 3:
deleteExistingAccount();
break;
case 4:
showAllData();
break;
case 5:
showAllData();
break;
default:
print("Invalid");
}
} while (choice != 6);
}
} //Variable of teacher type