Talk Like A Pirate Day

 * class Pirate is a English to Pirate translator
 * @author Chris Thiel
 * @version 15 September 2007
 * A "nifty assignment" from Dave Reed at Creighton University
 * presented at SIGCSE 2004
 * Talk like a Pirate Day is September 19th
 * A fun way to introduce 2 dimensional arrays, Scanner class, 
 * and String comparision
 * Improvements that can be made:
 * more words
 * less sensative to capitalization ( perhaps lowerCase() )
 * addition of random (50% chance) of "Arrrr"s in the translations
 * (care should be taken to avoid consecutive "Arrr"s)
 * Bugs to be repaired:
 * "hi" is translated as "yo-ho-ho" but
 * "this" is translated "tyo-ho-hos"
import java.util.Scanner;

public class Pirate
    // instance variables - replace the example below with your own

    static String [] [] phrase = 
       {{"hello", "ahoy"}, 
        {"hi", "yo-ho-ho"}, 
        {"pardon me", "avast"},
        {"excuse me", "arrr"},
        {"my", "me"}, 
        {"friend", "me bucko"}, 
        {"sir", "matey"}, 
        {"madam", "proud beauty"}, 
        {"miss", "comely wench"}, 
        {"stranger", "scurvy dog"}, 
        {"officer", "foul blaggart"}, 
        {"where", "whar"}, 
        {"is", "be"}, 
        {"the", "th'"}, 
        {"you", "ye"},
        {"tell", "be tellin'"}, 
        {"know", "be knowin'"},
        {"how far", "how many leagues"}, 
        {"old", "barnacle-covered"},
        {"attractive", "comely"}, 
        {"happy", "grog-filled"}, 
        {"nearby", "broadside"}, 
        {"restroom", "head"}, 
        {"restaurant", "galley"},
        {"hotel", "fleabag inn"}, 
        {"pub", "Skull & Scuppers"},
        {"bank", "buried treasure"}
    static String english="";
    static String pirate="";
    public static void main(String[]args)
        Scanner keyboard=new Scanner(;
        System.out.print("Pirate translator\n(Type \"quit\" to end)\n");
        while (!english.equals("quit"))
          System.out.print("Type English Here: ");
          english = keyboard.nextLine();

          for (int i = 0; i< phrase.length; i++)
            pirate=pirate.replaceAll(phrase[i][0], phrase[i][1]);
          System.out.println("Pirate Translation: "+pirate);