Lab 1 (Program Design)
Lab 1 (Program Design)
Exercise 1
Input: a, b, c
Exercise 3
engName
examMark
idNum
itemsInCart
Exercise 4
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
2
Exercise 5
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
PROBLEM: In New York City (NYC), even numbered streets are east-bound, odd numbered streets
are west-bound. Given a street number of a street in NYC, decide the direction of the street, either east-
bound or west-bound. Print a message on screen to tell the user the direction.
3
4
Exercise 6
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
PROBLEM: Calculate the parking fee based on the vehicle type and the hours a vehicle spent in a car
park. The parking fee is charged according to the table below.
5
Exercise 7
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
PROBLEM: Input an examination mark (0-100) and determine the grade (A to F) obtained according
to the table below.
Grade F D C B A
6
Exercise 8
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
PROBLEM: As the user to input a positive integer value (n) and then displays ‘*’ times on the screen.
A sample execution is shown below.
Please input a positive integer: 5
*****
HINT: Use the repetition construct. At each iteration, you need to determine if enough ‘*’ have been
printed.
7
8
Exercise 9
Draw a flow chart to illustrate how the problem below can be solved. Specify clearly the input, process,
and output steps with correct flowchart symbols.
PROBLEM: Given the width and length of a piece of rectangular paper, determine the maximum
number of small-size rectangular photos that can be printed on it. The photos can be arranged either in
portrait or landscape.
Portrait arrangement:
Landscape arrangement:
9
END.
10