Iteration Challenges

Write programs for each of the following problems

1. Develop a program that will repeatedly accept as data input a customer’s surname, forename, and middle initial (separately), and display forename, middle initial, and surname. The user will finish by typing ‘QUIT’ or ‘quit’ as the surname.
e.g.
Please type the surname of customer : Simpsom
Please type the forename of customer : Homer
Please type the middle initial of customer : J

Customer Name : Homer J Simpson

2. Develop a program that will repeatedly calculate the SUM and the PRODUCT of three numbers entered at the keyboard. The end of data will be a first number of 99.

3. Develop a program that will repeatedly work out an employee’s net pay. The number of hours worked, and the hourly rate of pay are entered at the keyboard. Assume that a constant tax of £30 is deducted for everyone. The last employee will be indicated by a negative number of hours.

4. Develop a program for Sunny Day Tours that will work out the cost of a family holiday. The program should accept as data input the number of adults and number of children in the party. The program should calculate the hotel bill at £60 per adult, and £20 per child, and calculate the fare as £210 per adult, and £110 per child. The program should display the total holiday cost. The loop will be terminated by data input of 0 for number of adults.

5. Develop a program that will take in a temperature in degrees Centigrade and convert it into degrees Fahrenheit, and will display degrees Fahrenheit.

The formula to convert Centigrade to Fahrenheit is:
Fahrenheit = (Centigrade * 9/5) + 32

The program should continue to convert temperatures until the user types a negative value for Centigrade.

6. Develop a program that will convert the number of ounces entered (Integer) into the equivalent value in pounds and ounces and display the equivalent values.
(16 ounces = 1lb)

Note: The following prompt is to be displayed on screen:
‘Do you wish to convert a number of ounces? (Y/N)’

The program should continue to convert ounces into pounds and ounces while the reply to the prompt is ‘Y’.

Next: Functions and Parameter Passing