1. Hate/Love Program (10 points)

    Problem 2.7 (p 116): Write a program that reads a line of text and then displays the line, but with the first occurrence of hate changed to love. For example, a possible sample diaglog might be:

    Enter a line of text.
    I hate you.
    I have rephrased that line to read:
    I love you.
  2. Making Change (10 points)

    Problem 2.10 (p 117): Write a program that determines the change to be dispensed from a vending machine, An item in the machine can cost between 25 cents and a dollar, in 5-cent increments (25, 30, 35, ..., 90, 95, or 100), and machine accepts only a single dollar bill to pay for the item. For example, a possible dialogue with the user migh be:

    Enter price of item
    (from 25 cents to a dollar, in 5-cent increments): 45
    You bought an item for 45 cents and gave me a dollar,
    so your change is
    2 quarters,
    0 dimes, and
    1 nickel.

  3. Date Converter (10 points)

    Problem 2.13 (p 118): Write a rpogram that reads a string for a date in the format month / day / year> and displays it in the format day . month . year, which is a typical format used in Europe. For example, if the input is 06/17/08, the output should be 17.06.08. Your program should use JOptionPane for input and output.

  4. Order (10 points)

    Problem 3.2 (p 190): Write a program to read in three nonnegative integers from the keyboard. Display the integers in increasing order.

  5. Temperature Converter (10 points)

    Problem 3.5 (p 190): Write a program that allows the user to convert a temperature given in degress from either Celsius to Fahrenheit or Fahrenheit to Celsius. Use the following formulas:

    Degrees_C = 5(Degrees_F - 32)/9 
    Degrees_F = (9(Degrees_C)/5) + 32
    Prompt the user to enter a temperature and either a C or c for Celsius and an F or f for Fahrenheit. Convert the temperature to Fahrenheit if Celsius is entered, or to Celsius if Fahrenheit is entered. Display the result in a readable format. If anything other than C, c, F, or, f is entered, print an error message and stop.

Submitting Your Problem Set

You should submit all problems for grading by the deadline (see class schedule for date). To submit a program, you need to demonstrate (during office hours or lab) your program and explain how it works.