0% found this document useful (0 votes)
72 views5 pages

T4 Worksheet 4

Uploaded by

arushi.agupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views5 pages

T4 Worksheet 4

Uploaded by

arushi.agupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Worksheet 4 Flowcharts

Unit 6 Algorithms

Name:...................................................................................................... Class: ......................

Task 1
1. Draw a flow diagram for an algorithm which calculates how much money a student will need
per week to buy a meal and two drinks each weekday. The user should be prompted to
enter how much a meal costs, how much a drink costs, and then calculate and display the
total required.

1
Worksheet 4 Flowcharts
Unit 6 Algorithms

2. Draw a flow diagram for an algorithm which asks someone to enter their age in years. It
then calculates the number of days they have been alive. Assume that there are 365 days
in each year.

2
Worksheet 4 Flowcharts
Unit 6 Algorithms

Task 2
Jasmine plays a game on her computer screen. A moving balloon appears on the screen, and
she has to pop the balloon by clicking on it with the mouse. When the balloon is popped another
one appears. The aim of the game is to pop as many balloons as possible in one minute.

The flow diagram for the game is shown below.

Start

Time = 0

A balloonScore = 

Display new balloon

Yes
Balloon
C
touched?

D No
Display new balloon

Time  60? B

No

End

(a) Complete the statement at A.


(b) Complete the statement in B.
(c) Complete the statement at C.
(d) Complete the line and label at D.
(e) Add a flowchart box at the bottom to display the player’s score.

3
Worksheet 4 Flowcharts
Unit 6 Algorithms

Task 3
Michael is writing a program for a dice game played with three dice.

(a) The player rolls the dice, and is given points according to the following algorithm.

State the value of the scores if the dice rolled are:

246

551

444

(b) Some rolls of the dice produce a negative score. State a set of three numbers that can be
used to test whether the algorithm produces a negative score when it should, and state the
expected output of your test data.

4
Worksheet 4 Flowcharts
Unit 6 Algorithms

Task 4
An amusement park operates a smartcard system for visitors. When they enter the park, a
visitor chooses the amount they wish to put on their card. Rides cost differing amounts, and to
get through a barrier for a particular ride, the visitor inserts their card. The balance on the card
is checked. If there is enough money on the card, the balance is updated and displayed and the
barrier opens. If there is not enough money left on the card, the current balance is displayed
with a message “Not enough for this ride – need to top up”.

Complete the flowchart for the barriers in the amusement park.

Task 5
For each of the flowcharts in tasks 1-4, identify where sequence, selection and iteration have
been used. Note that some of the flowcharts do not use all three of these.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy