Use Microsoft Word . Write the pseudo code for the following scenario. You canno
ID: 3699540 • Letter: U
Question
Use Microsoft Word .
Write the pseudo code for the following scenario. You cannot use global variables. You have to use local variables and methods which may take parameters or not.
You have to write the pseudocode to mimic and ATM machine. Assume the original balance is $5000.
Your program must contain methods to:-
Display the choices to him ( a - deposit, b - withdraw , c - balance inquiry) and get the choice. Based on the choice call the methods to deposit , withdraw or balance inquiry. Do some error checking such as - if the user tries to withdraw more than the balance - display an error message that withdrawl denied. If after the withdrawl his balance is Below $100 - display a warning stating "Balance below $100".
Explanation / Answer
Start:
Enter choice:
case a: goto deposit()
break
case b: goto withdraw()
break
case c: goto balanceenquiry()
break
deposit():
int initial_balance=5000
float deposit
output "enter the amount to be deposited "
balance=initial_balance + deposit
update initial_balance in accounts database
break
withdrawal():
float deduct
output " enter the money to be deducted "
if(initial_balance)<=100 then
output " withdrawal denied"
else:
initial_balance=initial_balance - deduct
update initial_balance in accounts database
break
balanceenquiry():
output " balance from accounts database "
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.