You are going to create a PhoneRecord class containing the following properties:
firstName
- which is a String lastName
- which is a String
number
- which should also be a String
The properties will be public, and it should have two constructors: one that simply constructs the string and another that accepts values for first name, lastname and phone number.
You should also create a class called Phone Book
. It should contain an array of Phone Records and a count of how
many records there actually are. The number of records is passed to it by the
constructor call, i.e.,:
PhoneBook pb = new PhoneBook(3);
will construct a phone book that can contain up to 3 listings.
The methods are:
readRecord()
- which reads in a new
phone record. toString(int i)
- which returns a
string containing record #i
writeRecord(int i)
- which writes record #i
. writeBook()
- which writes the entire phone book.Write another class that uses the phone book, obtaining its size as a command line argument. Read in several records, write one or two of them and write the whole phone book.