



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This COBOL program simulates a simple ATM system with PIN registration, authentication (up to 3 attempts), and basic banking operations like checking balance, depositing, and withdrawing money. It ensures valid transactions and loops through the menu until the user chooses to exit. The program uses structured `PERFORM` blocks, `EVALUATE` for menu handling, and 88-level condition names for clarity. While functional and well-organized, it could be improved with input validation and additional features like PIN change or transaction history.
Typology: Assignments
1 / 7
This page cannot be seen from the preview
Don't miss anything!
DISPLAY "Thank you for using COBOL ATM.". DISPLAY "Have a nice day!". STOP RUN. REGISTER-USER. DISPLAY "============================". DISPLAY " REGISTER ". DISPLAY "============================". DISPLAY "Please set your 4-digit PIN: " WITH NO ADVANCING ACCEPT WS-USER-PIN DISPLAY "Enter initial deposit amount: $" WITH NO ADVANCING ACCEPT WS-ACCOUNT-BALANCE IF WS-ACCOUNT-BALANCE < 0 DISPLAY "Invalid amount. Setting default balance to $1000.00" MOVE 1000.00 TO WS-ACCOUNT-BALANCE END-IF
DISPLAY "4. Exit". DISPLAY "============================". DISPLAY "Enter your choice (1-4): " WITH NO ADVANCING. ACCEPT WS-CHOICE. EVALUATE WS-CHOICE WHEN 1 PERFORM CHECK-BALANCE WHEN 2 PERFORM DEPOSIT WHEN 3 PERFORM WITHDRAW WHEN 4 MOVE 0 TO WS-CONTINUE-SESSION WHEN OTHER DISPLAY "Invalid option. Please try again." END-EVALUATE. IF CONTINUE-SESSION DISPLAY "Do you want to perform another transaction? (Y/N): " WITH NO ADVANCING ACCEPT WS-CONTINUE IF WS-CONTINUE = "N" OR WS-CONTINUE = "n" MOVE 0 TO WS-CONTINUE-SESSION END-IF END-IF. CHECK-BALANCE. DISPLAY "============================". DISPLAY " ACCOUNT BALANCE ". DISPLAY "============================".
DISPLAY "Your current balance is: $" WS-ACCOUNT-BALANCE. DISPLAY "============================". DEPOSIT. DISPLAY "============================". DISPLAY " DEPOSIT ". DISPLAY "============================". DISPLAY "Enter amount to deposit: $" WITH NO ADVANCING. ACCEPT WS-TRANSACTION-AMT. IF WS-TRANSACTION-AMT > 0 ADD WS-TRANSACTION-AMT TO WS-ACCOUNT-BALANCE DISPLAY "Deposit successful!" DISPLAY "New balance: $" WS-ACCOUNT-BALANCE ELSE DISPLAY "Invalid amount. Deposit must be greater than zero." END-IF. DISPLAY "============================". WITHDRAW. DISPLAY "============================". DISPLAY " WITHDRAWAL ". DISPLAY "============================". DISPLAY "Enter amount to withdraw: $" WITH NO ADVANCING. ACCEPT WS-TRANSACTION-AMT. IF WS-TRANSACTION-AMT <= 0 DISPLAY "Invalid amount. Withdrawal must be greater than zero." ELSE IF WS-TRANSACTION-AMT > WS-ACCOUNT-BALANCE DISPLAY "Insufficient funds!"