Reaction Timer

Step 4 – program the timer

Now we'll program the timer. I'm not going to give you the answer here, but I am going to tell you what to do. Read the points carefully and think – you can do this!

The screenshot at the bottom the page shows you the framework to use.

There are two parts to the program:

Part A:

  1. do a countdown (you did this in step 3)
  2. create a variable called  start and use it to record the start time (you did this in both step 1 and step 2)
  3. display a diamond (step 3)

Part B:

  1. create a variable called  end to record the end time (this is shown in the screenshot)
  2. create a variable called  reaction and use it to work out how long the reaction time was (you did this with duration in step 2)
  3. display the variable  reaction (step 2)

Just work through both parts of the program and test it to see if it works.

The framework for the program is here:

Code image