fixed java example
This commit is contained in:
parent
b95670f5fb
commit
4d86c2b495
@ -50,7 +50,7 @@ class AddPerson {
|
||||
stdout.println("Unknown phone type. Using default.");
|
||||
}
|
||||
|
||||
person.addPhone(phoneNumber);
|
||||
person.addPhones(phoneNumber);
|
||||
}
|
||||
|
||||
return person.build();
|
||||
@ -80,7 +80,7 @@ class AddPerson {
|
||||
}
|
||||
|
||||
// Add an address.
|
||||
addressBook.addPerson(
|
||||
addressBook.addPersons(
|
||||
PromptForAddress(new BufferedReader(new InputStreamReader(System.in)),
|
||||
System.out));
|
||||
|
||||
|
@ -9,14 +9,14 @@ import java.io.PrintStream;
|
||||
class ListPeople {
|
||||
// Iterates though all people in the AddressBook and prints info about them.
|
||||
static void Print(AddressBook addressBook) {
|
||||
for (Person person: addressBook.getPersonList()) {
|
||||
for (Person person: addressBook.getPersonsList()) {
|
||||
System.out.println("Person ID: " + person.getId());
|
||||
System.out.println(" Name: " + person.getName());
|
||||
if (person.hasEmail()) {
|
||||
if (!person.getEmail().isEmpty()) {
|
||||
System.out.println(" E-mail address: " + person.getEmail());
|
||||
}
|
||||
|
||||
for (Person.PhoneNumber phoneNumber : person.getPhoneList()) {
|
||||
for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
|
||||
switch (phoneNumber.getType()) {
|
||||
case MOBILE:
|
||||
System.out.print(" Mobile phone #: ");
|
||||
|
Loading…
Reference in New Issue
Block a user