Heads+or+Tails

Specification
Write a program which displays a large coin on the screen. Each time the coin is clicked, a message should be displayed to indicate whether the result is heads or tails. A score should be kept for the number of heads and the number of tails.

Below is a sample screen design:



Design
Inputs: Click on the coin Process: Toss the coin Outputs: Display the result

A random number (1 or 2) to represent heads or tails: //**RandomNumber**// The total number of times heads has been tossed: //**HeadsCount**// The total number of times tails has been tossed: //**TailsCount**//
 * Variables**

//**When green flag clicked**// 1. Initialise variables 1.1 Set HeadCount to 0 1.2 Set TailsCount to 0
 * Algorithm**

//**When Coin Clicked**// 1. Choose a random number 1.1 Set HeadsOrTails to random number between 1 and 2

2. Test if Heads or Tails 2.1 If HeadsOrTails = 1 Then 2.2 Display "Heads" 2.3 Add 1 to HeadsCount 2.4 Else 2.5 Display "Tails" 2.6 Add 1 to TailsCount 2.7 End If

Program
Write the program

Testing
Test the program