You are on page 1of 3

Teacher: Mrs.

Valli Number of pupils: 22

Class/Set: 9N2

Date: 14/03/12

Time/Period: 3&4

Room: CC Level:5/6

Subject: Guess High & Low BYOB/ Excel VBA Scheme of Work:

Learning Objectives (WALT): Able to understand the importance of writing algorithm for any programming projects.

Able to manage the time efficiently and follow the requirements needed for developing the game using BYOB/ Excel VBA Be creative and innovative in extending the game project.

Intended Learning Outcomes (WILF): All must be able to: understand how to design algorithm for given problem. Most should be able to: create the guessing high-low game and documentation. Some could: extend the game by adding additional features/ improvements. Keywords: guess, high, low, lives, random number, algorithm, tests, validation, screenshots, output, lives, score, music, background, screens. Reference to cross-curriculum issues (Literacy, Numeracy, Citizenship, PSHE, ECM..): Entry ( 2.5 mins) Starter (5 mins): Guessing High-Low Number Program When you have asked to program, what is the first thing comes into your mind? (a) Programming Languages (b) Algorithm Main ( 55 mins): Explain WILF Algorithm for High-Low Number Program Computer generates a random number between 1 and 1000. The program then invites a user to make a guess If the guess is too high or low the program will display a suitable message. The program should keep track of the number of guesses lost all lives, a message You lose. Resources GuessHighLow. pptx

When the user has guessed the number, a message You win correctly OR when the user

Documentation You should produce an algorithm showing the design of the program A test plan indicating the numbers you are going to use there should be at least 3 tests Screenshots showing the programs running Output from the program No of guesses

Validation: if char is entered instead a number, if same number entered again

How could you extend your game?

BYOB Guess High Low Game

Excel VBA Guess High Low Game Basic Open Excel Click Developer Tab ToolBox Button Drag to form Right-Click Button Assign Macro Macro Name Guess Number New Click Visual Basic Start Writing the Code Save the file as Guess.xlsm

HighLow_Excel VBA_Tutorial.do c

Code Sub GuessNumber() Sub procedure just like block in BYOB Dim x As Integer Declare variable x as integer Randomize Function to generate random number x = Int(100 * Rnd + 1) Int((UpperNumber - LowerNumber + 1) * Rnd + LowerNumber) Sheet1.Cells(1, "A") = x Assign Cell(Row=1, Column=A) to random number Dim NoOfGuess, Guess, I As Integer NoOfGuess = InputBox(Prompt:="Your No of Guess?") Asking user number of guess For i = 1 To NoOfGuess Using For..Next Loop to loop through no. of guess Guess = InputBox(Prompt:="Your Guess?") Asking user to guess the number If Int(Guess) < Sheet1.Cells(1, "A") Then If user guess is < than random number generated MsgBox ("Your Guess is lower than mine!") Display a message ElseIf Int(Guess) > Sheet1.Cells(1, "A") Then If user guess is > than random no. generated MsgBox ("Your Guess is higher than mine!") Else If user guess is same with random number generated MsgBox ("Congrats,that's correct!") End End If Next End Sub Demo: 1) BYOB Guess High Low Game 2) Excel VBA Guess High Low Game Guess.ypr Guess.xlsm

Exit ( 2.5 mins) Plenary ( 10 mins): AFL Differentiation (related to Learning Outcomes) - G & T: Create another guessing game using words. Homework : Game & documentation to be completed and uploaded to VLE for marking. Assessment including WILF: Questioning & Discussion (AfL) 1) What have you learnt from doing this exercise? 2) Any difficulties? Evaluation of the lesson: Good Informal observations made by curriculum mentor [x]: Good

You might also like