Category: Software Design & Devlopment

Scratch – Calculations using a loop

Today we recapped performing calculation within and using a loop. We started off redoing the 6 times table task, before improving it to display all the times tables from 1 to 10.

TimesTable

We then created a program that took in 4 ages and displayed the total only using one user created variable

Age

These two programs make use of loops to reduce the number of programming lines, this making the program more efficient.

 

Using a message box to make a choice

It is possible to use a MsgBox to make a choice in your program. You first of all assign a integer variable to the MsgBox then you change the buttons attributes to vbYesNo. vbYesNo is a VB constant that represents a value, the use of the constant means that you do not need to memories the number, vbYes and vbNo are other examples of these VB constants. An IF statement is then used to make the selection.

N5

S3 – Conditional Loops

A conditional loop is used to repeat part of the program until a condition is true.

The program shown here is a password checker. The program will exit the loop if the user guess is 1233 or the user has had 3 attempts. This uses a  complex conditional  statement with the logical operator OR, the OR logical operator returns a true value when one of the conditions are true.

The final IF statement checks if the user has entered the correct password before saying welcome.

Homework for 3rd Nov 2014

  1. What is the number system used by computers? (1)
  2. State two advantages of using binary numbers rather than decimal numbers in a computer system. (2)
  3. The reserve price of a vase is £42·50. State how a real number such as 42·50 would be represented in the computer. (1)
  4. A program calculates the average rainfall for one week as 18.6mm. Describe how floating point representation is used to represent real numbers. (2)
  5. Convert the decimal number 13 into a binary number. (1)
  6. Convert the following binary numbers in to decimal (2)
    1. 00001011
    2. 10011111
  7. Convert the following decimal numbers into binary  (2)
    1. 63
    2. 193
  8. Convert the binary number 11011 into a decimal number. (1)
  9. State one reason why computer systems use binary numbers rather than decimal numbers. (1)
  10. Convert the decimal number 27 into an 8 bit binary number. (2)

Total 15

Creating an Advent Calender in Scratch

It is fairly easy and quick in scratch to create an advent calender.

  • Add the design to the stage background.
  • Add sprite that has the number of the door on it.
  • Add an extra costume to the sprite that will be the gift.
  • Add a script to switch costume when the sprite is clicked.

If it’s so easy then why do I have a video on it? Watch and see after the jump

Read more