1. ATM Machine
Simulation: C
Program
This Presentation details the creation of a C
program simulating an ATM. The program
include core features such as balance
inquires , deposits and withdrawals.
PREPARED BY:24ITJ091_RAJ PARSANIYA
24ITJ090_Merja Dharmya
3. Program Overview
Purpose
• To create a user-friendly
program that replicates the
experience of using an ATM.
Functionality
• The program allows users to
check their balance, deposit
funds, and withdraw money
within specified limits.
Structure
• The program utilizes functions to
handle different ATM operations,
organized for modularity and
maintainability.
User Interaction
• The program prompts users with
clear instructions and guides
them through each transaction.
4. Pseudo Code for ATM Transactions
Welcome Message
• Display a welcoming message to the user, introducing the ATM service.
PIN Validation
• Prompt the user for their PIN and compare it to the stored correct PIN.
Transaction Menu
• Present a menu of available transactions to the user, such as
withdrawal, deposit, or balance inquiry.
Transaction Processing
• Based on the user's selection, perform the corresponding transaction,
updating the account balance and transaction history.
5. Key Functions
Check Balance()
Displays the current
account balance to the
user.
Deposit Money()
Processes the deposit
amount and updates the
account balance.
Withdraw Money()
Handles withdrawal
requests, checks sufficient
balance, and updates the
balance.
6. Variable Declaration and Initialization
Variable Name Data Type Description
balance
Correct PIN
Transaction Count
float
char[]
int
Stores the user's account
balance.
Stores the correct PIN for
user authentication.
Keeps track of the number of
transactions performed.
7. PIN Validation Function
Input PIN
• The user enters their PIN, which is stored in the input PIN array.
Comparison
• The system compares the entered PIN with the stored correct PIN
using the strcmp function.
Validation Result
• The function returns 1 if the PINs match and 0 otherwise.
8. Algorithm
1. Start
• Display a welcome message to the user.
2. Prompt for Card Insertion
• Wait for the user to insert the card by pressing a key.
3. PIN Validation
• Prompt the user to enter their PIN.
• Validate the entered PIN against the correct PIN ("1234").
• If the PIN is correct, proceed to the main menu. Otherwise, display "Access denied" and exit.
4. Main Menu Loop (if PIN is correct):
• Display the main menu with the following options:
• Withdraw Money
• Check Balance
• Transfer Money
• View Transaction History
• Exit
9. 5. User Selection (based on user input):
Option 1: Withdraw Money:
• Ask the user for the amount to withdraw.
• If the amount is greater than the available balance or less than or equal to zero, display an error message.
• If the withdrawal is valid, deduct the amount from the balance, update the transaction history, and show
the new balance.
Option 2: Check Balance:
• Display the current balance.
Option 3: Transfer Money:
• Ask the user for the account details and transfer amount.
• If the transfer amount exceeds the balance or is invalid (<=0), display an error.
• If valid, deduct the transfer amount from the balance, update the transaction history, and show the new
balance.
10. Option 4: View Transaction History:
• Display the list of recent transactions (up to 10) showing the description and amount for
each.
• If no transactions have been made, display a message saying "No transactions made yet."
Option 5: Exit:
• Display a thank-you message and end the program
6. Repeat the Main Menu (until the user chooses to exit):
• Continue looping through the main menu until the user selects
option 5.
7. End
• Terminate the program.
11. Deposit and
Withdraw
Deposit
• The deposit function
prompts the user for the
amount they wish to
deposit. It validates the
input and adds the deposit
to the account balance.
Withdraw
• The withdraw function
requests the amount the
user wants to withdraw. It
checks if the account
balance is sufficient. If so, it
deducts the withdrawal
amount from the balance.
12. TRANSACTION HISTORY
• the transaction history feature is implemented to
keep track of recent transactions made by the user.
The program defines a structure Transaction that
holds the transaction's description (such as
"Withdrawal" or "Transfer") and the amount
involved. This information is stored in an array of
Transaction structures, with a maximum capacity to
store the last 10 transactions.
13. Conclusion
• This code walkthrough provides a foundational
understanding of ATM transaction processing. Further
improvements could include implementing error handling,
security enhancements, and advanced features like
account transfers.