-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPhoneBook.java
More file actions
121 lines (118 loc) · 4.17 KB
/
PhoneBook.java
File metadata and controls
121 lines (118 loc) · 4.17 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
package Practice.Phone;
import java.util.Scanner;
import static Practice.Phone.MainMenu.phone;
public class PhoneBook {
static Scanner key = new Scanner(System.in);
static int n;
static int b;
static int c;
public static void phonebook() {
System.out.println("""
...Phone book
1. Search
2. Service Nos.
3. Add name
4. Erase
5 Edit
6 Assign tone
7. Send b'card
8. Options
9. Speed dials
10. Voice tags
99. Main Menu
""");
n = key.nextInt();
switch (n) {
case 1:
System.out.println("""
___search___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 2:
System.out.println("""
___service nos.___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 3:
System.out.println("""
___add name___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 4:
System.out.println("""
___erase___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 5:
System.out.println("""
___edit___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 6:
System.out.println("""
___assign tone___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 7:
System.out.println("""
___send b'card___
"0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 8: options();
case 9:
System.out.println("""
___speed dials___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 10:
System.out.println("""
___voice tags___
0. back""");
b = key.nextInt();
if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
case 99: phone();
default: System.out.println("invalid number"); phonebook();
}
}
private static void options() {
System.out.println("""
___option___
1. Type of view
2. Memory status
0. back""");
b = key.nextInt();
if (b == 1) { System.out.println("""
___type of view___
0. back""");
c = key.nextInt();
if (c == 0) options();
else System.out.println("option does not exist"); phonebook();
}
else if (b == 2) { System.out.println("""
___memory status___
0. back""");
c = key.nextInt();
if (c == 0) options();
else System.out.println("option does not exist"); phonebook();
}
else if (b == 0) { phonebook(); }
else { System.out.println("option does not exist"); phone(); }
}
}