-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathannoted_file
More file actions
174 lines (174 loc) · 6.13 KB
/
annoted_file
File metadata and controls
174 lines (174 loc) · 6.13 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
167
168
169
170
171
172
173
174
class Register{
String fname,sname,lname,dist,div,loc,subloc,ward,consti,count,gen;
@Nullable String change;
int id,option;
@Nullable String state;
int looper=1;
Register(){
Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
System.out.println("\nVOTER REGISTRATION\n==================================\nPlease Fill in the form below to register the voter:\nFirst Name:");
fname = input.nextLine();
System.out.println("Second Name:");
sname = input.nextLine();
System.out.println("Last Name:");
lname = input.nextLine();
System.out.println("ID Number:");
try{
id= input2.nextInt();
}
catch(java.util.InputMismatchException e){
System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
System.out.println("Sorry! The input is invalid. Please put a number only");
System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n\nTry here again:");
id= input3.nextInt();
System.out.println("\n");
}
System.out.println("District:");
dist = input.nextLine();
System.out.println("Division:");
div = input.nextLine();
System.out.println("Location:");
loc = input.nextLine();
System.out.println("Sub-location:");
subloc = input.nextLine();
System.out.println("Ward:");
ward = input.nextLine();
System.out.println("Constituency");
consti = input.nextLine();
System.out.println("County");
count = input.nextLine();
System.out.println("Gender:");
gen = input.nextLine();
showdetails();
}
void changeinfo(@UnderInitialization(Object.class) Register this){
System.out.println("\nChoose the detail to edit:");
System.out.println("1. First name\t4. ID number\t7. Location\t10. Constituency\n2. Second Name\t5. District\t8. Sub-location\t11. County\n3. Last Name\t6. Division\t9. Ward\t12. Gender\n");
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
try{
option = input2.nextInt();
}
catch(java.util.InputMismatchException e){
System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
System.out.println("Sorry! The input is invalid. Please put a number only");
System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n\n");
changeinfo();
}
Scanner newinputs = new Scanner(System.in);
switch(option){
case 1:{
System.out.println("\nFirst Name:");
fname=newinputs.nextLine();};
break;
case 2:{
System.out.println("Second Name:");
sname=newinputs.nextLine();};
break;
case 3:{
System.out.println("Last Name:");
lname=newinputs.nextLine();};
break;
case 4:{
System.out.println("ID number:");
try{
id= input2.nextInt();
}
catch(java.util.InputMismatchException e){
System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
System.out.println("Sorry! The input is invalid. Please put a number only");
System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n\nTry here again:");
id= input3.nextInt();
System.out.println("\n");
}
};
break;
case 5:{
System.out.println("District:");
dist=newinputs.nextLine();};
break;
case 6:{
System.out.println("Division:");
div=newinputs.nextLine();};
break;
case 7:{
System.out.println("Location:");
subloc=newinputs.nextLine();};
break;
case 8:{
System.out.println("Sub-Location:");
fname=newinputs.nextLine();};
break;
case 9:{
System.out.println("Ward:");
ward=newinputs.nextLine();};
break;
case 10:{
System.out.println("Constituency:");
consti=newinputs.nextLine();};
break;
case 11:{
System.out.println("County:");
count=newinputs.nextLine();};
break;
case 12:{
System.out.println("Gender:");
gen=newinputs.nextLine();};
break;
default:System.out.println("Sorry your choice is invalid.");
}
showdetails();
}
void showdetails(@UnderInitialization(Object.class) Register this){
System.out.println("\nPlease confirm the following details:\n\n==============================================");
System.out.println("\n\t\tVoter Details\n");
System.out.println("Name: "+fname+" "+sname+" "+lname);
System.out.println("ID number: "+id);
System.out.println("District: "+dist);
System.out.println("Division: "+div);
System.out.println("Location: "+loc);
System.out.println("Sub-Location: "+subloc);
System.out.println("Ward: "+ward);
System.out.println("Constituency: "+consti);
System.out.println("County: "+count);
System.out.println("Gender: "+gen+"\n");
System.out.println("==============================================");
System.out.println("\nIs this information correct?(y/n)");
Scanner input = new Scanner(System.in);
change=input.nextLine();
if(change.equals("n")){
changeinfo();
}
else if(change.equals("y")){
System.out.println("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
System.out.println("SUCCESS! information is being uploaded!");
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
exitStrategy();
}
}
void LooperMethod(){
while(looper==1){
Register myRegister = new Register();
}
}
void exitStrategy(@UnderInitialization(Object.class) Register this){
System.out.println("Exit or continue(E/C)");
Scanner input = new Scanner(System.in);
state = input.nextLine();
if(state.equals("C")){
looper=1;
}
else if(state.equals("E")){
looper=0;
System.out.println("==========================");
System.out.println("©2017 Cryosoft Corporation");
System.out.println("==========================");
}
else{
System.out.println("\nSorry The input is invalid....\n");
exitStrategy();
}
}
}