Loop (Unconditional)

icon picker
Track Times


example requirement

The program should allow a user to enter the number of tracks on an album. Then the user should enter the list of track times as a decimal fraction (2 min 30 sec would be 2.5). The program should add up the times using running total.
example ticket design
How many tracks:
How many minutes for track: 1
How many minutes for track: 2
total running time: 6.25
example steps
set the totalMinutes to 0

prompt for the number of tracks
enter the number of tracks

loop for number of tracks with index
prompt for the number of minutes for track
enter the number of minutes

add the number of minutes to the totalMinutes
end loop

display the totalMinutes

developer task

Read the requirement, sample output and design.
Run the example code in the program. Read the error messages.
Try to locate and fix the bugs, there are more than one!
Read the code. Try to recognise the names, types and values for each variable.
Identify the for-loop control structure.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.