-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNew.java
More file actions
35 lines (32 loc) · 1.26 KB
/
New.java
File metadata and controls
35 lines (32 loc) · 1.26 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
package contacts_list;
import java.util.Scanner;
public class New extends Contact{
public static void newContact(){
Scanner in = new Scanner(System.in);
Contacts = ReadFromFile.read();
while (true){
Contact c = new Contact();
System.out.print("Név: ");
String nameIn = in.nextLine();
String[] namePcs = nameIn.split(" ");
if(nameIn.length() == 0) break;
c.lastName = namePcs[0];
c.firstName = namePcs[1];
System.out.print("Becenév: ");
String nicknameIn = in.nextLine();
c.nickname = noData.nothing(nicknameIn);
System.out.print("Cím: ");
String addressIn = in.nextLine();
c.address = noData.nothing(addressIn);
System.out.print("Munkahelyi szám: ");
String workPhoneNumberIn = in.nextLine();
c.workPhoneNumber = noData.nothing(workPhoneNumberIn);
System.out.print("Privát szám: ");
String privateNumberIn = in.nextLine();
c.privatePhoneNumber = noData.nothing(privateNumberIn);
Contacts.add(c);
}
WriteToFile.write(Contacts);
Menu.mainMenu();
}
}