Next: Introduction to User-defined functions Up: Top-down design using Functions Previous: Review Questions

Exercises

  1. Each competitor in a race is started separately. The start and finish time for each competitor is noted in hours, minutes and seconds. The number of competitors is available as is the distance of the race in miles. Design an algorithm which will initially enter the number of competitors and the distance of the race and will then enter for each competitor a competitor number together with the competitor's start and finish times. The competitor's elapsed time should then be output in minutes and seconds together with the average speed in miles per hour. It is desirable that the start and finish times should be validated as being legal times in the twenty four hour clock. In designing your algorithm identify at the initial stage which tasks could be carried out by using functions. Do not expand the functions any further but specify what they should do and also specify their input parameters and output parameters.



Next: Introduction to User-defined functions Up: Top-down design using Functions Previous: Review Questions