-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddressBookMain.java
121 lines (109 loc) · 4.1 KB
/
AddressBookMain.java
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
import java.util.Scanner;
public class AddressBookMain {
public static void main(String[] args) {
System.out.println("Welcome to address book program");
AddressBook c1 = new AddressBook();
c1.setFirstName("bob");
c1.setLastName("james");
c1.setAddress("bakers street");
c1.setCity("panjim");
c1.setState("goa");
c1.setZip("403001");
c1.setPhoneNumber("2714511");
c1.setEmail("[email protected]");
AddressBook c2 = new AddressBook();
c2.setFirstName("steph");
c2.setLastName("curry");
c2.setAddress("bay area");
c2.setCity("ohio");
c2.setState("california");
c2.setZip("11582");
c2.setPhoneNumber("2255443");
c2.setEmail("[email protected]");
ContactStore contactStore = new ContactStore();
contactStore.add(c1);
contactStore.add(c2);
Console console = new Console();
console.print(contactStore.getContactList());
ConsoleV2 console2 = new ConsoleV2();
console2.print(contactStore.getContactListTwo());
Scanner sc = new Scanner(System.in);
System.out.println("Enter 1 to add details to AddressBook and 2 to add to AddressBookTwo");
int select = sc.nextInt();
if (select == 1) {
AddressBook newContact = new AddressBook();
Scanner sc1 = new Scanner(System.in);
System.out.println("Enter details ");
System.out.println("Enter first name ");
newContact.setFirstName(sc1.nextLine());
System.out.println("enter last name ");
newContact.setLastName(sc1.nextLine());
System.out.println("enter address ");
newContact.setAddress(sc1.nextLine());
System.out.println("enter city ");
newContact.setCity(sc1.nextLine());
System.out.println("enter state ");
newContact.setState(sc1.nextLine());
System.out.println("enter zip ");
newContact.setZip(sc1.nextLine());
System.out.println("enter phone number ");
newContact.setPhoneNumber(sc1.nextLine());
System.out.println("enter email ");
newContact.setEmail(sc1.nextLine());
contactStore.add(newContact);
console.print(contactStore.getContactList());
}
else if (select == 2) {
AddressBookV2 newContact2 = new AddressBookV2();
Scanner sc1 = new Scanner(System.in);
System.out.println("Enter details ");
System.out.println("Enter first name ");
newContact2.setFirstName(sc1.nextLine());
System.out.println("enter last name ");
newContact2.setLastName(sc1.nextLine());
System.out.println("enter address ");
newContact2.setAddress(sc1.nextLine());
System.out.println("enter city ");
newContact2.setCity(sc1.nextLine());
System.out.println("enter state ");
newContact2.setState(sc1.nextLine());
System.out.println("enter zip ");
newContact2.setZip(sc1.nextLine());
System.out.println("enter phone number ");
newContact2.setPhoneNumber(sc1.nextLine());
System.out.println("enter email ");
newContact2.setEmail(sc1.nextLine());
contactStore.add(newContact2);
console2.print(contactStore.getContactListTwo());
}
// ContactStore contactStore = new ContactStore();
// contactStore.add(c1);
// contactStore.add(c2);
// contactStore.add(newContact);
// Console console = new Console();
// console.print(contactStore.getContactList());
//
// Scanner sc = new Scanner(System.in);
// System.out.println("Enter name of contact you want to edit");
// String name = sc.nextLine();
// if(c1.getFirstName().equalsIgnoreCase(name) == true)
// console.edit(c1);
// else if(c2.getFirstName().equalsIgnoreCase(name) == true)
// console.edit(c2);
//// else if(newContact.getFirstName().equalsIgnoreCase(name) == true)
//// console.edit(newContact);
// System.out.println("Contact List after edit");
// console.print(contactStore.getContactList());
// Scanner sc = new Scanner(System.in);
// System.out.println("Enter person contact you want to delete");
// String contactName = sc.nextLine();
// if(c1.getFirstName().equalsIgnoreCase(contactName))
// contactStore.delete(c1);
//// else if(newContact.getFirstName().equalsIgnoreCase(contactName))
//// contactStore.remove(newContact);
// else if(c2.getFirstName().equalsIgnoreCase(contactName) == true)
// contactStore.delete(c2);
// System.out.println("Contact List after deletion");
// console.print(contactStore.getContactList());
}
}