Due February 13, 1999 at the beginning of class.Please turn in your source code and adequate example sessions to test your programs for each of the four parts.
Part A:
Programming Project 4.19 from page 169.Part B:
Expand upon the BankAccount class built in class (or the one you built in Assignment Two) by adding a name and an interest rate. Both of these should be private fields with public getters but no setters: they can only be set when the object is created. Make sure that you have a number of constructors, and that a default account can be created with a zero-parameter constructor. Also add apublic void monthlyUpdate();function which adds a month's worth of interest to the account.
Show the use of this class in a main which creates at least three named accounts with at least two different interest rates and then displays their balances each month for a few years.Part C:
A palindrome is a word or sentence which is the same spelled backwords or forwards. Create a class called Palindrome. It will need no constructor, because it should contain (so far) only thepublic static boolean isSimplePalindrome( String testWord);function which returns true if the test word is a palindrome and false otherwise. For example, given the word 'toot', this function would return true. This function only needs to be accurate for single words.
Create another class (perhaps called UserInterface) which has a main that queries the user in a loop whether she/he would like to test a word, and if so, takes the word as an input and returns the proper answer. If the user answers no, the program should quit.
Hint: Use the length() and charAt() functions of the String class. Don't forget that the index of the first char in the string will be 0, so the index of the last char in the string will be length - 1.Part D:
Expand the Palindrome class to include another static functionpublic static boolean isPalindrome( String testPhrase);which determines whether or not a phrase is a palindrome. This function will ignore spaces, capitalization, and punctuation when determining palindrome status. Thus both 'Too hot to hoot' and the ever-famous 'A Man, A Plan, A Canal. Panama!' will qualify as palindromes.
Use a slightly modified version of your UserInterface class created above to show that your new function works.
YourisSimplePalindromefunction must not be changed in this new version of the class
Hint: Use toLowerCase in java.lang.String and a java.util.StringTokenizer to ready the phrase for evaluation by your already created 'isSimplePalindrome' function.
The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.