Count+Occurrences+(programming)

The principle of count occurrences is very similar to that of a linear search. The program should loop through a list of numbers counting the number of times a given number appears.
**Example** A list of numbers is as follows: 1 7  2  7  4  8  5

Count the occurrences of the number 7

The program should repeat through the list, comparing each number with the number being counted. The first number in the list is 7. Is this the number being counted? No. The next number in the list is 7. Is this the number being counted? Yes. Add 1 onto the counter. The next number in the list is 2. Is this the number being counted? No. The next number in the list is 7. Is this the number being counted? Yes. Add 1 onto the counter.

The program will continue to loop through the full list of numbers, and at the end display the total number of occurrences found.

Specification
Write a program which counts the occurrences of a number in a list.

Input Process Output
Inputs: Number for which occurrences are to be counted Process: Count occurrences Output: Total number of occurrences

Algorithm
1. set counter to 0 2. get occurrences_number 2. repeat for all numbers in list

2.1 if current_number = occurrences_number then 2.1.1 counter = counter + 1 2.2 end if

3. end repeat 4. display counter

The Task
1. Draw a screen design, with labelled fields and buttons 2. Copy the algorithm 3. Write the program