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, 23.06.2019 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
question
Computers and Technology, 24.06.2019 08:10
Where are american poets found in the dewey decimal system
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
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
Chemistry, 06.06.2021 16:00
question
Mathematics, 06.06.2021 16:00
question
Chemistry, 06.06.2021 16:10
Questions on the website: 13722363