Question
Create an object-oriented program that works as a personal, editable telephone directory. It will operate through the interaction of two objects: Interface and Directory. The
Create an object-oriented program that works as a personal, editable telephone directory. It will operate through the interaction of two objects: Interface and Directory.
The Interface object will interact with the user, taking requests, and sending information to the Directory object, where the data is actually stored.
The methods of the Interface object should be:
- searchByLastName(string lastName)
- searchByNumber(int number)
- addEntry(string lastName, string firstName, int number)
The methods of the Directory object should be:
- returnName(int number)
- returnNumbers(string last Name)
- updateList(string lastName, string firstName, int number)
The Directory object should also contain three arrays of size 10, in which the indexes correspond; that is number[0] should be the phone number for lastName[0] and firstName[0]. When your program begins, you should have at least 4 numbers and names already present, so that you can test the search functions.
Sample Output
Welcome to your personal directory system.
Choose from the options below:
l A listing of all names and numbers based on the last name
n The name of an individual based on a 7-digit phone number
a Add a new entry to the directory
q Quit the program
Selection: x
Invalid input.
Selection: n
Enter the phone number: 8337322
Name: Smith, John
Choose from the options below:
l A listing of all names and numbers based on the last name
n The name of an individual based on a 7-digit phone number
a Add a new entry to the directory
q Quit the program
Selection: l
Enter the last name: Smith
Records:
Smith, John 8337322
Choose from the options below:
l A listing of all names and numbers based on the last name
n The name of an individual based on a 7-digit phone number
a Add a new entry to the directory
q Quit the program
Selection: a
Enter the new number: 7778888
Enter the first name: Frank
Enter the last name: Jones
Directory updated.
Choose from the options below:
l A listing of all names and numbers based on the last name
n The name of an individual based on a 7-digit phone number
a Add a new entry to the directory
q Quit the program
Selection: l
Enter the last name: Jones
Records:
Jones, Frank 7778888
Choose from the options below:
l A listing of all names and numbers based on the last name
n The name of an individual based on a 7-digit phone number
a Add a new entry to the directory
q Quit the program
Selection: q
Thank you for using the personal directory system.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started