Directions Points The file must be called <LastFirstChapter10.java> (driver prog
ID: 3541105 • Letter: D
Question
Directions Points
The file must be called <LastFirstChapter10.java> (driver program)
LiFiAddressBook.java
Ensure you include ALL files required to make your program compile and run.
I would like to see your .java files only.
If possible, submit all programs as a single .zip file (not required)
Proper coding conventions required the first letter of the class start with a capital
letter and the first letter of each additional word start with a capital letter.
Overall Requirements
Write a program that simulates an address book.
Driver main method should be as shown below. Add comments to explain
functionality
import java.util.ArrayList;
public class LastFirstChapter10
//Replace LastFirst with your Last Name and First Name
{
public static void main(String [] args)
{
ArrayList<LiFiAddressBook> aBook = new ArrayList<LiFiAddressBook>();
//Replace LiFi with Last Initial First Initial (for all instances)
for (int count = 0; count < 1; count++)
{
//****************************
//add code here to add new entry to ArrayList
//call addEntry
//print blank line
//****************************
}
int foundIndex = LiFiAddressBook.search(aBook);
System.out.println();
if (foundIndex > -1)
aBook.get(foundIndex).display();
else
System.out.println("No Entry Found");
}
}
Output should be as shown in example at bottom.
LiFiAddressBook.java class
Instance variables:
First Name (string)
Last Name (integer)
Street Address (string)
City State (string)
Zip Code (string)
addEntry method:
Get input for variables above. See sample in example at bottom.
search method:
Receive ArrayList as argument
Output Search Menu (see example at bottom)
Utilize a switch and search ArrayList for field specified.
Return index number if entry found or -1 if not found
display method:
Print results as shown in example at bottom.
Sample session:
Please Enter First Name: Ken
Please Enter Last Name: Dewey
Please Enter Street Address: 6420 SE 15th St.
Please Enter City, State: Midwest City, OK
Please Enter Zip Code: 73110
Please Enter First Name: Nick
Please Enter Last Name: Dewey
Please Enter Street Address: 3232 Longridge Rd.
Please Enter City, State: Del City, OK
Please Enter Zip Code: 73115
Please Enter First Name: Steve
Please Enter Last Name: Jones
Please Enter Street Address: 1205 Waynes Place
Please Enter City, State: Moore, OK
Please Enter Zip Code: 73024
Search Menu;
1. First Name
2. Last Name
3. Street Address
4. City, State
5. Zip Code
Please Enter Field to Search: 1
Please enter value to search for: Nick
First Name: Nick
Last Name: Dewey
Street Address: 3232 Longridge Rd.
City, State: Del City, OK
Zip Code: 73115
If the item is not found:
No Entry Found
As always, you should:
Explanation / Answer
//Replace LastFirst with your Last Name and First Name
{
public static void main(String [] args)
{
ArrayList<LiFiAddressBook> aBook = new ArrayList<LiFiAddressBook>();
//Replace LiFi with Last Initial First Initial (for all instances)
for (int count = 0; count < 1; count++)
{
//****************************
//add code here to add new entry to ArrayList
//call addEntry
//print blank line
//****************************
}
int foundIndex = LiFiAddressBook.search(aBook);
System.out.println();
if (foundIndex > -1)
aBook.get(foundIndex).display();
else
System.out.println("No Entry Found");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.