Sequential Exercises
1. Develop
a program that will accept a temperature in Fahrenheit and output the equivalent
temperature in Celsius.
[Specimen answer]
2. Develop a program
that will allow the user to enter two meter readings (present and previous)
and calculates the amount owed when charged at 6.67p per unit.
[Specimen answer]
3. Extend the previous
exercise to produce an invoice. It should include a standing charge of £12.60
and VAT at 5%. Output the information in a suitable format. Use a constant definition
for the standing charge.
[Specimen answer]
4. Develop a program
that will take a time in seconds and output it in hours, minutes and seconds.
[Specimen answer]
5. Consider the following:
The diagram below is the plan of a bathroom.
All dimensions are in metres.
The shaded area is the bath and will not require tiling (obviously). Each square tile is of side 20cm.
The tiles can only be bought in packs of 15 and cost £9.95 per pack.
Required, a program that will calculate the number of packs and cost of the tiles required to cover the non-shaded area.
NOTES: The bathroom dimensions and tiles are in different units.
Use a constant definition for the conversion. C++ has a function ceil() which is contained in the header file math.h, to round up a double data type.
For example the following program snippet will output the value 7.