Documente Academic
Documente Profesional
Documente Cultură
Summary Layout
1. Looping
Define following terms:
b. Definite Loop………………………….
c. Counter–controlled loop………………………………….
d. Indefinite Loop……………………………..
e. Nested loops………………………
f. Outer loop…………………………………
g. Inner loop…………………………………
h. Stub…………………………………….
2. Exercises
a. b. c.
d. e. f.
2.2
a. Design a program for the Hollywood Movie Rating Guide, which can be installed in a
kiosk in theaters. Each theater patron enters a value from 0 to 4 indicating the
number of stars that the patron awards to the guide’s featured movie of the week. If
a user enters a star value that does not fall in the correct range, prompt the user
continuously loop until a correct value is entered. The program executes
continuously until the theatre manager enters a negative number to quit. At the end
of the program, display the average star rating of the movie.
C1102 Introduction to Computer Systems and Programming Week 9
b. Modify the movie rating program so that a user gets three tries to enter a valid
rating. After three incorrect entries, the program issues an appropriate message and
continues with a new user.
2.3
Design the logic for a program that allows a user to enter a number. Display the sum of
every number from 1 through the entered number.
C1102 Introduction to Computer Systems and Programming Week 9
2.4
a. Design the logic for a program that outputs numbers in reverse order from 25 down
to 0.
b. Design the logic for a program that outputs every even number from 2 to 100.
c. Design the logic for a program that outputs every number from 1 to 20, along with
its value doubled and tripled.