Question: **Java Language only** (Direction of code :Write a class named PhoneBookEntry that has fields for a persons name and phone number. The class should have
**Java Language only**
(Direction of code :Write a class named PhoneBookEntry that has fields for a persons 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.)
Instructions:Take this code ((make sure it works in textpad, currently showing error for two public classes!!)) and put detailed comments on it and a uml diagram at the top of the code in comment form.
I Will Thumbs Up Thanks!!
import java.util.ArrayList; import java.util.Scanner;
public class PhoneBookEntryTest {
public static void main(String[] args) { ArrayList
}
public class PhoneBookEntry { private String name; private long phoneNo; public PhoneBookEntry (String name, long phneNo){ this.name = name; this.phoneNo = phneNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getPhoneNo() { return phoneNo; } public void setPhoneNo(long phoneNo) { this.phoneNo = phoneNo; } public String toString(){ return "Person Name: "+getName()+" Phone Number: "+getPhoneNo(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
