You are on page 1of 3

CORNWALL COLLEGE

COMPUTER SCIENCE UNIT 1


Worksheet #2
May 2013
A certain cellular company provides the following rates for voice calls.
 First 10 minutes $1.50 per minute
 Any additional minutes $0.50 per minute
Reads an integer value representing the number of minutes used for voice calls, calculates and
prints the cost of calls.
Construct a flow chart to represent a solution to the following problem.

May 2014
Data exists for ten items. Each line of data consists of a product name, price and discount %.
You are required to read the data and complete the following tasks.
(i) Print the product name, the discount for that product followed by the new price.
For example, given
Shirt 120 25
The algorithm should print
Shirt 30 90
where “Shirt” is the product, $30 is the discount of 25% and $90 is the price after
the discount.
(ii) Print the TOTAL amount of product discounts overall.

If the total amount of discounts is greater than $500, print “Discounts exceeded.”
Construct a flow chart to represent the algorithm given in above
May 2018

May 2019

Consider the following algorithm where b, x and result are integers


Read a
Read b
If ((b>0) or (x<0))
Result = -1
Else
Result = 1
While (x>0) begin
Result = Result *b
x=x –1
end
Print Result
May 2021
The algorithm below is designed to determine the average weight (in kg) of a set of potatoes. A negative
weight is entered to signify the end of input.

In the space provided on page 17, draw a flowchart to represent the process flow
in the algorithm.

module average weight


sum = 0.0
count = 0
Read weight

While weight > 0


sum = sum + weight
count = count + 1
Read weight
End while
If count >0
average = sum/count
print average
Else
print “No data”
End if

You might also like