## Problem Solving Tasks for Loops

For each of the following problems go through the formal process of determining Data Input(s), Data Output(s), Data Processes, drawing up a Data Table and an Algorithm.

1. Develop an algorithm for 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' as the surname, eg:

Please type the surname of customer : Stonk
Please type the forename of customer : Hank
Please type the middle initial of customer : P

Customer Name : Hank P Stonk

1. Develop an algorithm for 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.
1. Develop an algorithm for 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.
1. Develop an algorithm 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.
1. 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. Amend the algorithm so that the program will continue to convert temperatures until the user types a negative value for Centigrade.
1. Develop an algorithm 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'.

This is the end of the current section. If you want to revise any of the topics you can navigate to them by using the menu at the left hand side of the page. If you want to return to the home page for this unit, click on the HN Computing logo at the top left of the page. You can also continue to the next topic by clicking the link below.