Table of Contents

    Example 1: ATM Simulation

    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:

    • while loop for PIN verification

    • if-else for PIN attempts and withdrawal check

    • switch for transaction menu

    • do-while loop for repeating the menu