Q:

How to generate a new table for my authentication table program?

I am building a small java program in netbeans that is about authentication tables. I have build the table and started building the tasks that the program uses. I have run into a couple of issues with my programming.
The main program code:
package ass2resub;

//Importing the java facilities I need for my program to run.
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
*
* @author Jacob
*/
public class Ass2Resub {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
     //I am using a scanner to get input from the user.
    Scanner scan = new Scanner(System.in);

//This is the way I am going to start the program. Its similar to an arraylist or linkedlist.
AuthenticationProviderBigram authProvider = new AuthenticationProviderBigram();

//This is all the data for my authentication table. The first column represents the co-ordinates that are on the table./n
//The second column represents the code within the table to be authenticated.
//This is pre-entered details so that you can have a feel for how the program will work.
authProvider.addAuthentication("A1", "Z1");
authProvider.addAuthentication("A2", "G4");
authProvider.addAuthentication("A3", "T8");
authProvider.addAuthentication("A4", "23");
authProvider.addAuthentication("A5", "N1");
authProvider.addAuthentication("A6", "Q1");
authProvider.addAuthentication("A7", "2B");
authProvider.addAuthentication("A8", "L3");
authProvider.addAuthentication("A9", "U7");

authProvider.addAuthentication("B1", "N4");
authProvider.addAuthentication("B2", "X1");
authProvider.addAuthentication("B3", "J8");
authProvider.addAuthentication("B4", "C9");
authProvider.addAuthentication("B5", "H9");
authProvider.addAuthentication("B6", "2U");
authProvider.addAuthentication("B7", "8R");
authProvider.addAuthentication("B8", "E7");
authProvider.addAuthentication("B9", "5K");

authProvider.addAuthentication("C1", "L3");
authProvider.addAuthentication("C2", "LS");
authProvider.addAuthentication("C3", "4S");
authProvider.addAuthentication("C4", "BH");
authProvider.addAuthentication("C5", "8D");
authProvider.addAuthentication("C6", "K9");
authProvider.addAuthentication("C7", "C3");
authProvider.addAuthentication("C8", "M6");
authProvider.addAuthentication("C9", "SK");

authProvider.addAuthentication("D1", "C4");
authProvider.addAuthentication("D2", "6X");
authProvider.addAuthentication("D3", "R4");
authProvider.addAuthentication("D4", "L9");
authProvider.addAuthentication("D5", "E5");
authProvider.addAuthentication("D6", "O7");
authProvider.addAuthentication("D7", "J5");
authProvider.addAuthentication("D8", "71");
authProvider.addAuthentication("D9", "6E");

authProvider.addAuthentication("E1", "9T");
authProvider.addAuthentication("E2", "4L");
authProvider.addAuthentication("E3", "B3");
authProvider.addAuthentication("E4", "AA");
authProvider.addAuthentication("E5", "9F");
authProvider.addAuthentication("E6", "8M");
authProvider.addAuthentication("E7", "8Y");
authProvider.addAuthentication("E8", "B1");
authProvider.addAuthentication("E9", "S8");

authProvider.addAuthentication("F1", "M9");
authProvider.addAuthentication("F2", "8U");
authProvider.addAuthentication("F3", "4J");
authProvider.addAuthentication("F4", "2S");
authProvider.addAuthentication("F5", "F3");
authProvider.addAuthentication("F6", "N8");
authProvider.addAuthentication("F7", "P7");
authProvider.addAuthentication("F8", "ZA");
authProvider.addAuthentication("F9", "P1");

authProvider.addAuthentication("G1", "O2");
authProvider.addAuthentication("G2", "4Q");
authProvider.addAuthentication("G3", "Y2");
authProvider.addAuthentication("G4", "K4");
authProvider.addAuthentication("G5", "B4");
authProvider.addAuthentication("G6", "ER");
authProvider.addAuthentication("G7", "T3");
authProvider.addAuthentication("G8", "H3");
authProvider.addAuthentication("G9", "D7");

//Declaring the names of the tasks the program is capable of.
//Once a selection is made it will load up that certain case and tell you what/n
//it needs to do its job.
  System.out.println("Authentication table program\n"
                + "1.Search for a certain co-ordinate to authenticate\n"
                + "2.Show the table\n"
                + "3.Generate a new table\n"
                + "4.Exit\n");

  //This is the while loop fnction that we se so that we can have the ability to go through the menu above.
        while(true) {

  //Declaring a integer variable for my switch so that I can gain input from the user so that it chooses/n
  //the one part of my program that they chose instead of all the rest of them all at once.
        int Choice = scan.nextInt();

switch (Choice) { //Start of my switch and cases.

    //The first function of the program is to search for the grid reference to see the/n
    //authentication code and to authenticate it.
   case 1:

          //This is the question that is displayed in the output box.
          System.out.print("The co-ordinates that your after: ");
          //This scans the next line to get the response from the user.
          String userInput = scan.next();
          //This then prints out the text and the code that is linked to the grid reference.
          System.out.print("I authenticate " + authProvider.authenticate(userInput));
   break;

   case 2:
       //This displays the table.
       System.out.print("This is the table: "  );
       break;

   case 3:

       break;

   case 4:
         //This is the case so that yo can exit ot of the program when you\n
                //have finished with it.

                System.out.println("Are you sure you want to exit the program(Yes(0) or No): ");
                scan.next();

                //Need an if function here so that I can act upon the users input.
                System.exit(0);

       break;
}
        }
}
}

The code for my java class:
package ass2resub;
//Importing the java facilities I need for my program to run.
import java.util.Map;
import java.util.HashMap;
/**
*
* @author Jacob Fellows
*/
public class AuthenticationProviderBigram 
{//Start of class.
//I am using a hash map with a map as data structures which can store the revelant information.
//I am decaring my Map and calling it authTable for short.
private Map<String, String> authTable;

//This is the way to make authTable a new hashmap.
public AuthenticationProviderBigram()
{
    this.authTable = new HashMap<>();
}

//This will get the input from the user via the scanner.
public String authenticate(String input)
{
    return this.authTable.get(input);
}

//This is the way to add new details to the table. You use the co-ordinates/n
//of the square and the code inside.
public void addAuthentication(String source, String expected)
{
    if(!this.authTable.containsKey(source))
        this.authTable.put(source, expected);
}

}//End of class.

That is the code that I have so far. 
Questions:

How do I display the tables data in a formatted way in java so that the user can see it in an order?
How would I generate a new table that has blank data in or the data could be inputted from the user to build up the simple table?

As you can see in the main program I am using a switch and case method to create an infinite loop. 
Thanks, 
Jacob.

A:

1.To display data in a formatted way
 public void showTable() {
    System.out.println("| Co-ordinate |  Code |");
    System.out.println("|---------------------|");
    for (String key : authTable.keySet()) {
        System.out.println("| " + key + "  |  " + authTable.get(key) + " |");
    }
    System.out.println("|---------------------|");
}

//In you mainclass
 case 2:
                //This displays the table.
                System.out.println("This is the table: ");
                authProvider.showTable();
                break;

2 a.Generate a new Table means.Emptying the old table[Map in your case]
  public void clearTable() {
    authTable.clear();
  }

 case 3:
                authProvider.clearTable();
                System.out.println("Table Emptied ");
                break;

2 b.Ask user to enter data.
    Add a new case to the switch.For ex 5.Enter New values
  case 5:
                System.out.print("Enter The co-ordinates you want to put: ");
                //This scans the next line to get the response from the user.
                userInput = scan.next();
                System.out.print("Enter the code value ");
                String codeValue = scan.next();
                authProvider.addAuthentication(userInput, codeValue);
                break;

