Yeah cool, so I made a driver:
public class AddressbookDriver { public static void main(String [] args) { AddressTextUi ui = new AddressTextUi(); ui.mainMenu(); } }
That links to the textUi
import java.io.*; import java.util.Scanner; public class AddressTextUi { private AddressBook addressbook; public void mainMenu() { displayMainMenu(); } private void displayMainMenu(){ BufferedReader keyIn = new BufferedReader(new InputStreamReader(System.in)); AddressTextUi addressBook = new AddressTextUi(); String act = ""; while(true) { //displays the options System.out.println("\n[A] ADD ENTRY"); System.out.println("[D] DELETE ENTRY"); System.out.println("[U] UPDATE ENTRY"); System.out.println("[V] VIEW ALL ENTRIES"); System.out.println("[S] SEARCH ENTRIES BY SURNAME"); System.out.println("[Q] Quit"); System.out.println("Enter desired action: "); try{ //gets the choice act = keyIn.readLine(); }catch(Exception e){ System.out.println("Error"); } //checks for the appropriate action if(act.equals("A")||act.equals("a")) addressBook.addEntry(); else if(act.equals("D")||act.equals("d")) addressBook.delEntry(); else if(act.equals("V")||act.equals("v")) addressBook.viewEntries(); else if(act.equals("U")||act.equals("u")) addressBook.updateEntry(); else if(act.equals("S")||act.equals("s")) addressBook.searchEntry(); else if(act.equals("Q")||act.equals("q")) {System.out.println("Program Closing Down"); System.exit(0);} else System.out.println("Unknown command"); } }