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 11:00
Which action is good business etiquette? a. switching your cell phone off before you enter a meeting b. keeping your cell phone on low volume before you enter a meeting c. setting a pleasant ring tone on your cell phone before you enter a meeting d. setting a standard ringtone on your cell phone before you enter a meeting
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
question
Computers and Technology, 23.06.2019 23:40
Which of the following calculates the total from the adjacent cell through the first nonnumeric cell by default, using the sum function in its formula? -average -autosum -counta -max
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
How are roger williams, james oglethorpe, and william penn similar?
Answers: 3
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, 15.03.2022 02:40
question
Mathematics, 15.03.2022 02:40