-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdmin.java
More file actions
166 lines (130 loc) · 3.88 KB
/
Admin.java
File metadata and controls
166 lines (130 loc) · 3.88 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import java.io.*;
import java.util.*;
class AdminMenu extends Headertop
{
static char choose;
static String code;
static boolean flag=false;
public static void menu()throws Exception
{
int choice;
String name,address,contact,category,hostel;
Scanner sc=new Scanner(System.in);
header();
head("ADMIN MENU");
centeralign("Greetings Dear Admin!WELCOME!");
System.out.println();
System.out.println("What do you wish to do?");
System.out.println("A] ADD");
System.out.println("M] MODIFY");
System.out.println("D] DELETE ");
System.out.println("V] VIEW ");
System.out.println("S] SEARCH");
System.out.println("E] EXIT");
do
{
flag=false;
System.out.println("Please enter a Valid Choice");
choose=Validate.enterChar();
if((choose=='A' || choose=='M' || choose=='D' || choose=='V' || choose=='S' || choose=='E'))
flag=true;
}while(flag==false);
switch(choose)
{
case 'A':
//Add records to institutions file
System.out.println();
System.out.println("ADD RECORD");
System.out.println("Enter code of Institute('ENG','MED','MNG','DES','LAW','JOU')");
code=enterCode();
Add.writerfile(code);
break;
case 'M':
System.out.println();
System.out.println("MODIFY RECORD");
System.out.println("Enter code of Institute('ENG','MED','MNG','DES','LAW','JOU')");
code=enterCode();
Modify.mod(code);
break;
case 'D':
System.out.println();
System.out.println("DELETE RECORD");
System.out.println("Enter code of Institute('ENG','MED','MNG','DES','LAW','JOU')");
code=enterCode();
Delete.del(code);
break;
case 'V':
System.out.println();
System.out.println("VIEW RECORD");
System.out.println("Enter code of Institute('ENG','MED','MNG','DES','LAW','JOU')");
code=enterCode();
View.readfile(code);
callagain();
break;
case 'S':
System.out.println();
System.out.println("SEARCH RECORD");
System.out.println("Enter code of Institute('ENG','MED','MNG','DES','LAW','JOU')");
code=enterCode();
View.readfile(code);
do
{
System.out.println("--------------------------------------------------------------------------------------------------------");
System.out.println("What would you like to Search by");
System.out.println("1] Name ");
System.out.println("2] Address ");
System.out.println("3] Contact ");
System.out.println("4] Category ");
System.out.println("5] Hostel Facility ");
System.out.println("6] Exit \n");
System.out.println("Enter your Choice");
choice=Integer.parseInt(enterInt()); //Validating for Integer
System.out.println("--------------------------------------------------------------------------------------------------------");
switch(choice)
{
case 1:
System.out.println("Enter Name");
name=enterString();
//Search by name
Search.searchfile(code,name);
break;
case 2:
System.out.println("Enter Address");
address=enterString();
//Search by address
Search.searchfile(code,address);
break;
case 3:
System.out.println("Enter Contact Number");
contact=enterContact();
//Search by Contact num.
Search.searchfile(code,contact);
break;
case 4:
System.out.println("Enter Category(National/International)");
category=enterCategory();
//Search by Category
Search.searchfile(code,category);
break;
case 5:
System.out.println("Enter Hostel Facility(Yes/No)");
hostel=enterHostel();
//Search by hostel facility
Search.searchfile(code,hostel);
break;
case 6:
callagain();
break;
default:
System.out.println("Please enter a valid choice");
}
}while(choice!=6);
break;
case 'E':
Main_menu.menu_disp();
break;
default:
System.out.println("Please enter a valid option");
}
}
}