Download presentation
Presentation is loading. Please wait.
1
Program: Mini Phone Book 2/11/2016
AP Computer Science Program: Mini Phone Book 2/11/2016
2
Create a ‘Contact’ class with the following Instance variables: - String name, - String phoneNumber, - String school Constructor: Sent a name and phone number Methods +String getName() +String getNumber() +String toString() +compareTo(Contact otherPerson) returns <0 if less than otherPerson.getName() returns 0 if equal to otherPerson.getName() returns >0 if greater than otherPerson.getName() Write an application with an ArrayList of contacts with the following menu items with a while loop Add contact Show all contacts Find contact: Input a name and search the ArrayList and return the phone number or a remark if the person is not in the ArrayList Find contacts from a school. Input the name of the school and show all of the contacts from that school. Push: Sort contacts by name Push: Sort contacts by School so that within each school the names are in order Push: Modify the add contact part of the menu to insert the new contact in order by name
3
Add ons (2/16/2016) Include the sort by name option
Modify the Add name to put the names in order alphabetically Modify the Find algorithm to use a Binary Search Binary Search
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.