Example 1: ATM Simulation
☰Fullscreen
Table of Content:
Problem Statement
Banks provide ATM machines where customers can perform transactions like check balance, deposit, withdraw money, and exit. Customers must enter the correct PIN to access their account. If a customer enters the wrong PIN more than 3 times, their account should be locked.
The system should repeatedly show a menu until the customer chooses to exit. The program must also check whether the withdrawal amount is greater than the available balance.
Control Flow Used:
-
whileloop for PIN verification -
if-elsefor PIN attempts and withdrawal check -
switchfor transaction menu -
do-whileloop for repeating the menu