This Problem Set Is Due By 11:59 PM on October 6, 2013

  1. Hand Shakes (5 points)

    Suppose we attend a party. To be sociable, when we arrive, we will shake hands with everyone who is already at the party. Write a program that prompts the user for the total number of guests at the party. Using the for statement, your program will compute, and display, the number of handshakes that occur as each guest arrives. Your program should also compute and display the total number of handshakes that occur after all guests have arrived.(Hint Upon arrival, each person shakes hands with everyone that is already there. You can assume that there is only one host for the party). Example:

    	How many guests are invited to the party: 5
    	When Guest 1 arrives, Handshakes=1, Total Handshakes=1
    	When Guest 2 arrives, Handshakes=2, Total Handshakes=3
    	When Guest 3 arrives, Handshakes=3, Total Handshakes=6
    	When Guest 4 arrives, Handshakes=4, Total Handshakes=10
    	When Guest 5 arrives, Handshakes=5, Total Handshakes=15
          

    Name this program HandShakes

  2. Coin Tosses (5 points)

    (Exercises #10, Page 249) Write a program that will compute stastics for eight coin tosses. The user will enter either an h for heads or a t for tails for the eight tosses. The program will then display to total number and percentages of heads and tails. Use the increment operator to count each h or t that is entered. For example, a possible sample dialogue between the program and the user might be:

    	For each coin toss enter either h for heads or t for tails.
    	First toss: h
    	Second toss: t
    	Third toss: t
    	Fourth toss: h
    	Fifth toss: t
    	Sixth toss: h
    	Seventh toss: t
    	Eighth toss: t
    	Number of heads: 3
    	Number of tails: 5
    	Percent heads: 37.5
    	Percent tails: 62.5
          

    Hint: You can use the switch statement to generate the desired output.

    Name this program CoinTosses

  3. Bank Interest (5 points)

    Write a program that prompts the user for a beginning bank balance and an interest rate. The program will display the value of the account at the end of each year for 10 years. The output should show the value of the account for three different methods of compounding interest:

    1. Annually: The interest is added once per year, at the end of the year. You can assume that the interest is posted exactly one year from the date of deposit.
    2. Monthly: The interest is added once per month, at the end of the month. You can assume that interest is posted exactly one month after the date of deposit. Hint: Be sure to adjust the interest rate for the time period of the interest. If the rate is 5%, you must use (5/12)% in the monthly case.
    3. Daily: The interest is added once per day, at the end of the day. You do not need to worry about leap years, assume that all years have 365 days. Hint: Be sure to adjust the interest rate for the time period of the interest. If the rate is 5%, you must use (5/365)% in the daily case.

    Your program should allow the user to perform the calculation multiple times for different starting balances. A negative starting balance indicates that the user is done.

    Name this program BankInterest

  4. Check Words (5 points)

    For all the following words, if you move the first letter to the end of the word, and then spell the word the result backwards, you will get the original word:

    	banana dresser grammar potato revive uneven assess
          

    Write a program that reads a word at a time and determines whether it has this property. Continue reading and testing words until you encounter the word quit. Treat upper case letters as lowercase letters.

    Name this program CheckWords

Please submit the completed assignment on Blackboard by attaching all your .java files. Make sure to attach all your programs to each submission.