[HELP] ATM algorithm and pseudo-code

Hey folks,
I’ve just started a CS class, and i need help with this material.
I accept any feedback and advice to complete this assessment.

Tasks

What I did so far:

Task 1 – Problem Decomposition

a)

b)
PROGRAM <ATM_WITHDRAWAL>
1.	DISPLAY 'Enter amount to withdraw’;
2.	INPUT amount;
3.	READ balance;
4.	dispense cash amount;
5.	balance = balance – amount;
6.	DISPLAY 'Your balance is’, balance;
END
Task 2

PROGRAM <ATM_WITHDRAWAL>
1.	IF card inserted
2.	        DISPLAY 'Enter amount to withdraw’;        
3.	        INPUT amount;
4.	        READ balance;
5.	        dispense cash amount;
6.	        balance = balance – amount;
7.	        DISPLAY 'Your balance is’, balance;
8.	ENDIF
END

Task 3
a)
DECLARE integer correctPIN ;
DECLARE integer pin;
b)

PROGRAM <ATM_WITHDRAWAL>
1.	DECLARE boolean valid ;
2.	DECLARE integer correctPIN ;
3.	DECLARE integer pin;
4.	SET valid = false ;
5.	IF card inserted
6.	DO
DISPLAY ‘Enter your PIN’;
INPUT pin;
READ correctPIN;
IF pin = correctPIN
valid = true;
ENDIF
7.	WHILE valid = false;
8.	ENDIF
9.	DISPLAY 'Enter amount to withdraw’;
10.	INPUT amount;
11.	READ balance;
12.	dispense cash amount;
13.	balance = balance – amount;
14.	DISPLAY 'Your balance is’, balance;

What is your question? Let us know where you are having a problem…

2 Likes