subject
Computers and Technology, 13.10.2020 01:01 rama64

JAVA ECLIPSE Write a class named PhoneBookEntry that has fields for a person's name and phone number. The class should have a constructor and appropriate accessor and mutator methods. Then write a program that creates at least five PhoneBookEntry objects and stores them in an ArrayList. use a loop[ to display the contents of each object in the ArrayList.
There this code:
import java. util.*;
public class PhoneBookEntry {
private String name;
private String number;
public PhoneBookEntry(String name, String number) {
this. name=name;
this. number=number;
}
public String getName() {
return name;
}
public void setName(String name) {
this. name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this. number = number;
}
public static void main(String[] args) {
List phoneList = new ArrayList();
phoneList. add(new PhoneBookEntry("John Smith","818.555.1234"));
phoneList. add(new PhoneBookEntry("Jane Brown","818.555.1235"));
phoneList. add(new PhoneBookEntry("Jose Vargas","818.555.1236"));
phoneList. add(new PhoneBookEntry("Armen Avetian","818.555.1237"));
phoneList. add(new PhoneBookEntry("Xin Liu","818.555.1238"));
phoneList. add(new PhoneBookEntry("James White","818.555.1239"));
phoneList. add(new PhoneBookEntry("Julie McGuiness","818.555.1240"));
phoneList. add(new PhoneBookEntry("Juan Ballardos","818.555.1241"));
phoneList. add(new PhoneBookEntry("Arthur London","818.555.1242"));
phoneList. add(new PhoneBookEntry("Ashot Aghajanian","818.555.1243"));
for (PhoneBookEntry entry : phoneList) {
System. out. println(entry. getName()+" "+entry. getNumber());
}
}
}

Gives me this output:
John Smith 818.555.1234
Jane Brown 818.555.1235
Jose Vargas 818.555.1236
Armen Avetian 818.555.1237
Xin Liu 818.555.1238
James White 818.555.1239
Julie McGuiness 818.555.1240
Juan Ballardos 818.555.1241
Arthur London 818.555.1242
Ashot Aghajanian 818.555.1243

I would like to get the output like this:
First Name: John\n
Last Name: Smith\n
Phone Number: 818.555.1234\n
\n
First Name: Jane\n
Last Name: Brown\n
Phone Number: 818.555.1235\n
\n
First Name: Jose\n
Last Name: Vargas\n
Phone Number: 818.555.1236\n
\n
First Name: Armen\n
Last Name: Avetian\n
Phone Number: 818.555.1237\n
\n
First Name: Xin\n
Last Name: Liu\n
Phone Number: 818.555.1238\n
\n
First Name: James\n
Last Name: White\n
Phone Number: 818.555.1239\n
\n
First Name: Julie\n
Last Name: McGuiness\n
Phone Number: 818.555.1240\n
\n
First Name: Juan\n
Last Name: Ballardos\n
Phone Number: 818.555.1241\n
\n
First Name: Arthur\n
Last Name: London\n
Phone Number: 818.555.1242\n
\n
First Name: Ashot\n
Last Name: Aghajanian\n
Phone Number: 818.555.1243\n
\n

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Martha is a healer, a healthcare provider, and an experienced nurse. she wants to share her daily experiences, as well as her 12 years of work knowledge, with people who may be interested in health and healing. which mode of internet communication can martha use?
Answers: 3
question
Computers and Technology, 23.06.2019 05:00
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Cómo pongo un tomo de llamada sin pagar?
Answers: 1
You know the right answer?
JAVA ECLIPSE Write a class named PhoneBookEntry that has fields for a person's name and phone numbe...
Questions
question
Mathematics, 27.09.2020 01:01
Questions on the website: 13722360