Académique Documents
Professionnel Documents
Culture Documents
ii. Add two public void methods which each take a Scanner object as a
parameter…
a. save, which takes a String as a parameter. The String is the name of the
file to save all of the Contact data to. Note that this method should not
throw any exceptions. If saving fails this should display “Unable to save.” as
well as the message of the associated exception
b. load, which takes a String as a parameter. The String is the name of the
file to load all Contact data from (previously loaded entries – if any – will be
lost). Note that this method should not throw any exceptions. If loading fails
this should display “Unable to load.” as well as the message of the
associated exception.
- Modify the existing ContactApp class to add two new options to the
menu. It should now match the sample below and function
appropriately, asking the user for a file name whenever they choose to
save or load the contact book.
1) List All Contacts
2) Add a Contact
3) Update a Contact
4) Remove a Contact
5) Save Contact Book
6) Load Contact Book
7) Exit
// Contact.java
public class Contact {
/*basic attributes*/
private String name;
private String address;
private String phone;
private String email;