Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ASSIGNMENT 2 - Review of Class Concept kas A Times Ne12 BIU The purpose of this assignment is to get familiar with the principle of
ASSIGNMENT 2 - Review of Class Concept kas A Times Ne12 BIU The purpose of this assignment is to get familiar with the principle of Object-Oriented Design. Create a project called Assignment 2. You will then write three classes: Assignment2.java - A driver class that contains only a main method which should do following: Create a new Phone Directory object While (true) { Prompt user to enter command; if (command is "a") { Prompt user for name and number; Create a phone record and store it in the database: } else if (command is "f"){ Prompt user for search key; Search the database for records whose names begin with the search key; (The user doesn't need to enter an entire name. The program will display all names that begin 7523 17.A. Assignment2.java- A driver class that contains only a main method which should do following: Create a new Phone Directory object While (true) { Prompt user to enter command; if (command is "a") { Prompt user for name and number; Create a phone record and store it in the database: } else if (command is "f") { Prompt user for search key; Search the database for records whose names begin with the search key; (The user doesn't need to enter an entire name. The program will display all names that begin with the characters entered by the user. The case of the input doesn't matter) Print these names and the corresponding phone numbers; } else if (command is "q") { Terminate program; } else { Display error message: OS ENGAGED STATES A PhoneDirectory.javaThis class contains an array of Phone Record objects. It should have the following data attributes and methods: private int numRecords - number of records in the array private Phone Records | data - array of Phone Record objects public Phone Directoryo - constructor that should initialize memory for data array and numRecords value public void enter Phone Records(Phone Record new.record) - store a new phone record in the database public void find Phone Record (String key) - Search the database for records whose names begin with the search key. The user doesn't need to enter an entire name. This method will display all names that begin with the characters entered by the user. The case of the input doesn't matter. If the customer number is not in the array, the program will print that the phone record does not exist". PhoneRecord.java - a class that contains the following data attributes and methods: private String name - the customer's name private String number - the customer's phone number public Phone Record(String personName, String phone Number) - constructor 1732 public void findPhoneRecord (String key) - Search the database for records whose names begin with the search key. The user doesn't need to enter an entire name. This method will display all names that begin with the characters entered by the user. The case of the input doesn't matter. If the customer number is not in the array, the program will print that the phone record does not exist". PhoneRecord.java - a class that contains the following data attributes and methods: Tie N12 private String name - the customer's name private String number - the customer's phone number public Phone Record(String personName, String phoneNumber) - constructor get/set Methods for each data attribute public String toStringo - Special method to be used when printing a phoneRecord object You should have correct comments and documentation like Homework! 7 8 5
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