Sinclair QL Beginner's Manual page 114

Hide thumbs Also See for QL:
Table of Contents

Advertisement

1. Six employees are identified by their surnames only. Each employee has a particular pension
fund rate expressed as a percentage. The following data represent the total salaries and pension
fund rates of the six employees.
Benson
Hanson
Johnson
Robson
Thomson
Watson
Write procedures to:
input the data into arrays.
compute the actual pension fund contributions.
output the lists of names and computed contributions.
Link the procedures with a main program calling them in sequence.
2. Write a function select with two arguments range and miss. The function should return a random
whole number in the given range but it should not be the value of miss.
Use the function in a program which chooses a random PAPER colour and then draws random
circles in random INK colours so that none is in the colour of PAPER.
3. Re-write the solution to exercise 1 so that a function pension takes salary and contribution rate as
arguments and returns the computed pension contribution. Use two procedures, one to input the
data and one to output the required information using the function pension.
4. Write the following:
a procedure which sets up a 'pack of cards'.
a procedure which shuffles the cards.
a function which takes a number as an argument and returns a string value describing the
card.
a procedure which 'deals' and displays four poker hands of five cards each.
a main program which calls the above procedures.
(see chapter 16 for discussion of a similar problem)
13,800
6.25
8,700
6.00
10,300
6.25
15,000
7.00
6,200
6.00
5,100
5.75

Advertisement

Table of Contents
loading

Table of Contents