-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathAddressBookDriver.java
More file actions
69 lines (62 loc) · 1.24 KB
/
AddressBookDriver.java
File metadata and controls
69 lines (62 loc) · 1.24 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
// ...
class Person
{
String name;
String phone;
int age;
Person(String name, String phone, int age)
{
this.name = name;
this.phone = phone;
this.age = age;
}
// ...
}
class AddressBook
{
ArrayList<Person> addressBook = new ArrayList<Person>();
Scanner s = new Scanner(System.in);
void show()
{
// ...
}
void add()
{
// ...
}
void modify()
{
// ...
}
void remove()
{
// ...
}
}
class AddressBookDriver {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
AddressBook abook = new AddressBook();
int command;
do {
System.out.print("1) add, 2) modify, 3) remove, 4) list, 5) exit > ");
command = s.nextInt();
switch (command) {
case 1:
abook.add();
break;
case 2:
abook.modify();
break;
case 3:
abook.remove();
break;
case 4:
abook.show();
break;
case 5:
break;
}
} while (command != 5);
}
}