Computer Science Department
CS1025/CS1026 Self Placement Guide
The following problem represents the level of programming expertise expected from students at the beginning of CS1025. The fundamental programming constructs involved in this example will be reviewed in CS1025; however, prior experience with the programming constructs is assumed.
1. The intent of this sample problem is to provide an example of the level of programming expected from students entering CS1025.
Computer Science Department does not provide grading of solutions to this sample
Using a high-level procedural programming language write a program that represents some actions of a bank’s automated teller machine as indicated by the following specifications:
a) Assume that the account balance is zero at the beginning of each run of the program.
The main should
implement the following algorithm:
IF pin is legal
IF menuChoice is WITHDRAWAL then
ELSE IF menuChoice is DEPOSIT then
ELSE IF menuChoice is DISPLAY_BALANCE then
ELSE IF menuChoice is TERMINATE then
REPORT good bye
WHILE menuChoice is not TERMINATE
else REPORT illegal pin
i. Italics are used in the algorithm to indicate modules
The algorithm is
incomplete. You should complete the algorithm (including writing algorithms for
the modules) before attempting to write the program.
c) A legal pin (personal identification number) is defined to be any even integer.
d) Assume that the withdrawal, deposit, and account balance amounts are represented in dollars (i.e. integers).
e) Module getPin must give the user a maximum of three attempts at entering a legal pin.
f) The program must appropriately handle the situation when a user enters a non-existent menu choice.
g) A user must not be allowed to withdraw:
i. more than the balance in their account
ii. a negative value
h) A user must not be allowed to deposit a negative value.
a) After you have written the program, be sure to test it with inputs representing the various situations the program is designed to handle.