Build a simple PhoneBook program.

PhoneBook.java 795B

12345678910111213141516171819202122232425262728293031323334353637
  1. import java.util.*;
  2. /**
  3. * Created by leon on 1/23/18.
  4. */
  5. public class PhoneBook {
  6. private String phoneNumber;
  7. private String name;
  8. private Map<String,String> input = new TreeMap<String,String>();
  9. public static void main(String [] args){
  10. }
  11. public PhoneBook(){
  12. this.input = new TreeMap<String, String>();
  13. }
  14. public void display(){
  15. if(this.input.containsKey(name)){
  16. for(Map.Entry<String,String> input: input.entrySet()){
  17. String value = input.getValue();
  18. String key = input.getKey();
  19. }
  20. }
  21. }
  22. public void remove(String name){
  23. this.input.remove(name);
  24. }
  25. public void AddInput(String name,String phoneNumber){
  26. this.input.put(name,phoneNumber);
  27. }
  28. }