Question
Simple ATM Machine (Using C language) Use file as database Use struct to represent each person record. Each initialization will load the database from a
Simple ATM Machine (Using C language)
Use file as database
Use struct to represent each person record.
Each initialization will load the database from a text file.
Each record will have:
- Account number
- Account name
- PIN
- Account balance
The ATM will have to show the following functions as the default screen menu:
- Account creation
- Login
The details of the screen menu are as follows. If the user press X and press enter at any of the menu, it will go back to the previous menu:
- Account creation
- Input name (min. 3 character)
- Input birthdate (dd/mm/yyyy)
- Input initial balance (min. 50000)
- Input PIN
The record will automatically generate the account number as first 8 characters of the name by omitting the spaces followed by the birthdate ddmm. If the name length is less than 8 characters, then pad with zeros.
Example:
Name : Edo Raemon
Birthdate: 12/12/1212
Account number = edoraemo1212
Name : Emon
Birthdate: 09/09/1909
Account number = emon00000909
The PIN will be numeric character without symbols and alphabets and the length must be 6 characters long.
Successful account creation will save the record into the struct and save it into file.
- Login
- Input account number
- Input PIN
If the account number is found and the PIN matched, show the main menu
If the account number is not found, show message Account does not exist. and the user must press enter to go back to the screen menu.
If the account number exists but the PIN does not match, show message Please input the correct PIN. and the user must press enter to go back to the screen menu.
Each successful login will show the following main menu:
- Account Balance
- Deposit
- Transfer
- Withdraw
- Change PIN
- Log out
The details of the screen menu are as follows. If the user press X and press enter at any stage of the following menu except Logout, it will go back to the previous menu:
- Account Balance
- Show the current account balance
Press enter to go back to the previous menu (main menu)
- Deposit
- Input the amount (must be a number)
Add the entered amount into the current balance then update the balance in the record.
- Transfer
- Input the destination account number
If the destination account number does not exists, show message Account does not exist. and the user must press enter to go back to the main menu.
- Input the transfer amount (must be a number)
If the inputted amount is more than the current balance, show message transfer amount exceeded the current balance. and the user must press enter to go back to the main menu.
If the transfer amount is less or equal the current balance, deduct the balance with the inputted transfer amount, update the balance in the record, and show message transfer success. Your current balance is . The user must press enter to go back to the main menu.
- Withdraw
- Input the withdraw amount (must be a number)
If the inputted amount is more than the current balance, show message transfer amount exceeded the current balance. and the user must press enter to go back to the main menu.
If the amount is less or equal the current balance, deduct the balance with the inputted amount, update the balance in the record, and show message Your current balance is .. The user must press enter to go back to the main menu.
- Change PIN
- Input the current PIN
If the PIN is wrong then show the message wrong PIN and then the user must press enter to go back to the previous main menu
- Input the new PIN
If the PIN is the same with the current PIN show message new PIN cannot be the same with the current PIN and ask the user to Input the new PIN again.
The PIN will be numeric character without symbols and alphabets and the length must be 6 characters long.
- Confirm the new PIN
The new entered PIN must be the same with the new entered PIN previously. If the inputted confirmation PIN is different, show message PIN does not match and ask the user to Input the new PIN again.
Update the PIN in the record
- Log out
- Go back to the main menu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started