1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import java.util.*;
- import java.util.Scanner;
- /**
- * Write a description of class PhoneBook here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class PhoneBook{
- Map<List, String> phonebook = new HashMap<>();
- List<String> multipleNumbers = new LinkedList<>();
- // public static boolean electronicPhonebook = true;
- // Scanner input = new Scanner(System.in);
- // Collection<String> c;
- // Iterator<String> iter = c.iterator();
- public PhoneBook(){
- }
- public void add(List multipleNumbers, String name){
- phonebook.put(multipleNumbers, name);
- }
-
- public void remove(String name){
- phonebook.remove(name);
- }
-
- public String lookup(String name){
- return phonebook.get(name);
- }
-
- public String reverseLookup(List number){
- return phonebook.get(number);
- }
-
- public void display(){
- System.out.println(" ***** WLECOME TO THE WORLD BOOK ***** ");
- for (Map.Entry<List,String> entry : phonebook.entrySet()){
- System.out.println("Όνομα: \n" + entry.getValue() + "\n" +
- "Αριθμός τηλεφώνου:" + "\n" + entry.getKey() + "\n");
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // public void addMultiple(){
- //
- // while(electronicPhonebook = true){
- // System.out.println("Enter a number and then a name. ");
- // String number = input.nextLine();
- // String name = input.nextLine();
- // phonebook.put(number, name);
- //
- // System.out.println("Are you done adding entries¿");
- // String exit = input.nextLine();
- // if (exit.equalsIgnoreCase("yes") || exit.equalsIgnoreCase("yeah") || exit.equalsIgnoreCase("Affirmative")){
- // electronicPhonebook = false;
- // } else
- // if (exit.equalsIgnoreCase("no") || exit.equalsIgnoreCase("nope") || exit.equalsIgnoreCase("nah")){
- // System.out.println("Okay...");
- // } else {System.out.println("I guess not...");
- // }
- // }
- // }
-
-
- // public static void commandCenter(){
- // PhoneBook runningbook = new PhoneBook();
- // while(electronicPhonebook = true){
- // runningbook.addMultiple();
- // }
- //
- // }
- }
|