Programming Assignment 2 (Due by 9 pm, Friday, September 12, 2008)

Goals of project: Practice with string manipulation, writing methods, defining and instantiating classes

Part I: Practice with Strings - Pig Latin

Note: For this project, treat y as a consonant.

The Pig Latin rules are:
1. If a word begins with a consonant - such as "string" - divide the word at the first vowel, swapping the front and back halves and append "ay" to the word - "ingstray".
2. If the word begins with a vowel - such as "am" - append "yay" to the word - "amyay".
3. If the word has no vowels (other than y) - such as "my" - append "yay" to it - "myyay".

Your PigLatin class should allow an English sentence to be converted to pig latin. Translate each word in the sentence to pig latin, preserving punctuation symbols as they are in the original sentence. Your class should contain the following methods:
translate(String) - this method translates its String parameter into pig latin.
translateWord(String) - this method translates a single word into Pig Latin.
findFirstVowel(String) - this method returns the location of the first vowel in its String parameter.

Of these methods, only the translate method needs to be public.

Your PigLatin class (main method) should prompt the user to enter an English sentence or phrase from the keyboard. It should then display the sentence in Pig Latin.

Sample Run (the user's input is in red):
Please enter a sentence: Hello World!
Your sentence in Pig Latin: elloHay orldWay!

Submit your program in file Use an appropriate header as indicated in the description of project 1. Make sure that you use documentation to make your program readable.

Part II: Defining and instantiating your own classes - Bank Account

For this programming assignment, you will write two classes. First write a class called BankAccount that represents a checking or savings account at a bank. The class should have methods that allow:
Your BankAccount class should store the account balance and an account number. Account numbers should begin with one; the first account created will have account number 1, the second account created will have account number 2, etc.

The second class that you write will be called AccountTest, and you will use it to test your BankAccount class. This class should create some BankAccount instances, and you will be graded on how adequately you test the functionality of the BankAccount class.

Make sure that your files have the appropriate headers, and documentation to make your program readable. Submit and via turnin.