Question
Implement the code below to the given directions Menu - this class is used to display menu options to the user. displayMenu() method display
Implement the code below to the given directions
Menu- this class is used to display menu options to the user.
- displayMenu() method display the program options a-f shown below (also see example session):
- a) Loading of entries from a file.
- b) Addition - prompting user for information to be used to create a new AddressEntry
- c) Removal - removing of an AddressEntry from the AddressBook. First a find is done (see below example session) and then the user selects from the find results what entry to remove.
- d) Find - prompts users for the begining of the users last name (they can enter a complete last name or just the start....all entries with that as the first part of their last name will be displayed). Note in the case when more then one entry is found a set will be returned.
- e) Listing - listing (a "dump") of the addresses in alphabetic order by the person's last name.
- f) Quit -note we are NOT saving any newly created AddressEntry objects (or removing objects either are not updated to the file) to the file, this data is lost, we will handle this issue in Project 2 when we store data more apporpriately in a database.
- NOTE: alter the prompt_* methods so that now they not only print out the prompt but, wait for the User to type into standard input and reads in the value and as necessary (for zip which is of type int) converts to appropriate type and returns that value. So prompt_Email() will ask user for Email read in what they typed and and returns a String. For prompt_Zip() it asks user for a zip and reads in value and converts to an int and returns this.
package address;
class Menu {
/**
* prompt_FirstName generates a standard output prompt for the First Name to be entered
*/
public String prompt_FirstName() {
return "First Name:";
}
//function prompts for last name
public String prompt_LastName(){
return "Last Name:";
}
//function prompts for street
public String prompt_Street(){
return "Street:";
}
//function prompts for city
public String prompt_City(){
return "City:";
}
//function prompts for state
public String prompt_State(){
return "State:";
}
//function prompts for zip
public String prompt_Zip(){
return "Zip:";
}
//function prompts for telephone
public String prompt_Telephone(){
return "Telephone:";
}
//function prompts for email
public String prompt_Email(){
return "Email:" ;
}
}
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