This problem set covers material from Chapters 2 and 3.
It should be submitted by the end of office hours on Tues. Feb. 25. To submit a program, you need to demonstrate (during office hours or class) your program and explain how it works. You may submit a program multiple times.
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.
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.
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.
Problem 3.2 (p 190): Write a program to read in three nonnegative integers from the keyboard. Display the integers in increasing order.
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)/9Prompt 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.
Degrees_F = (9(Degrees_C)/5) + 32
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.