2009 Old Spec

From TRCCompSci - AQA Computer Science
Revision as of 11:37, 29 November 2016 by Admin (talk | contribs) (Created page with "=Question 4= The variable table, Table 2, and the Structured English algorithm describes a simplified version of the Guess the Word/Phrase Game. ==Table 2== {| |- ! Identi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Question 4

The variable table, Table 2, and the Structured English algorithm describes a simplified version of the Guess the Word/Phrase Game.

Table 2

Identifier Data Type Purpose
NewWord String Stores the setter’s word to be guessed
UserWordGuess String Stores a word that is the user’s guess

Algorithm

   OUTPUT "The new word?"
INPUT NewWord
OUTPUT "Your guess?"
INPUT UserWordGuess
IF UserWordGuess IS EQUAL TO NewWord
THEN OUTPUT "CORRECT"
ELSE OUTPUT "INCORRECT"
ENDIF


What you need to do

  1. Write a program for the above algorithm in the programming language of your choice.
  2. Test the program as follows:
Test 1: Input of the new word EAGLE followed by a correct guess.
Test 2: Input of the new word BEAR followed by an incorrect guess.