-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddressBookMain.js
39 lines (35 loc) · 1008 Bytes
/
AddressBookMain.js
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
const AddressBook = require("./AddressBook.js");
const prompt = require("prompt-sync")();
let addressBook = new AddressBook();
let array = new Array();
exit = true;
while (exit) {
console.log("1.Add contact 2.Display Contact 3.Edit Contact 4.Delete Contact 5.Count Contact 6.Search Contact 0.Exit");
let options = parseInt(prompt());
switch (options) {
case 1:
addressBook.add(array);
break;
case 2:
addressBook.display(array);
break;
case 3:
addressBook.editContact(array);
break;
case 4:
addressBook.deleteContact(array);
break;
case 5:
addressBook.countContact(array);
break;
case 6:
addressBook.searchByCityOrState(array);
break;
case 0:
exit = false;
break;
default:
console.log("Please Choose Valid Option!");
break;
}
}