Page 1 of 15

Teachers guide to starting to

learn Just Basic

1 igover@somerset.gov.uk – April 2012

This guide is a suggestion in how to learn Just Basic1

. It is intended for educators and assumes

that Just Basic is already installed on the computer.

Most of this work is a summary of the tutorial to be found in the help menu. There is a lot of other

good help and guidance that can be found on the web.

Most the programs can be found here in a zipped file.

All good programmers plan what they are going to do before they complete a task. This ‘mission

statement’ is normally written in plain English as an algorithm (or pseudo code). Because of the

experiential nature of this tutorial this important step is highlighted in italics.

Program 1 – Working out VAT

In this first exercise we are going to create a program that:

1. Asks for an amount for goods before VAT is added;

2. Calculates a 20% VAT tax amount;

3. Displays the tax amount the total amount.

Type in the following into the main window

Click on will compile and run the program.

A new window should appear that allows you to enter an amount and then work out the VAT.

If you want to step through the program to see it working line by line click on . Move the

windows around so you see both the output window and the debugger.

Click on to step through the program line by line.

1

http://justbasic.com/

Page 2 of 15

Teachers guide to starting to

learn Just Basic

2 igover@somerset.gov.uk – April 2012

Program 2 – Checking the input for a zero amount

We are going to complicate our program by making it repeat every time and checking to see if the

amount entered is zero.

The algorithm becomes:

1. Asks for an amount for goods before VAT is added

2. Check to see if amount is greater than zero

a. If not display help file

3. Calculates a 20% VAT tax amount

4. Displays the tax amount the total amount

5. Returns to beginning of program

amount and tax are called variables.

Note the way in which label [start] and the sub routine help are used.

If you enter a number such as 123.12 into this program it will give you an answer of 147.744. Whereas this is true it

is not a good representation of money.

The INT() command can be used to round the number to 2 decimal places.

(int((tax*100)+0.5))/100 will round the VAT number to the correct number of decimal places

Page 3 of 15

Teachers guide to starting to

learn Just Basic

3 igover@somerset.gov.uk – April 2012

Program 3 – A number guessing game

This is a simple guessing game. The computer will pick a number between 1 and 100. The user

guesses the number in as few guesses as possible.

The algorithm is:

1. Pick a number between 1 and 100

2. Print program title and give some instructions

3. Ask for the user to guess number

4. Tally the guess

5. If the guess is right go to step (9)

6. If the guess is too low tell the user to guess higher

7. If the guess is too high tell the user to guess lower

8. Go back to step (3)

9. Beep and tell the user how many guess it took to win

10. Ask the user whether to play again

11. If the user answers yes then clear the guess tally and goto step (1)

12. Give the user instructions on how to close the game window

13. End the program

Compare the

program to the

algorithm.

The ‘grey

comments are

remark

statements

and can be

used if you

come back to

a program

after a long

while.