C++ Banking System[2022-12-13]
Description
- Customer account
In a bank, there are many types of accounts. To make it simple for this course project, we only consider two types of accounts: personal account and enterprise account.
The information about all the accounts of the bank is stored in a text file named account.txt in the following format:
account name password withdrawable category loan_amount loan_quota_left net_value
1001 Alita 123456 100000.23 personal 0 20000 100000.23
1002 Naruto 654321 101000.23 enterprise 1000 49000 100000.23
account customer account number. It contains 4 digits and starts from 1001 (the account number 1000 is reserved for the bank manager),
name customer name,
password login password. It must be a 6-digit number only,
withdrawable the amount of money that the customer can withdraw from the bank,
category category of customer. Must be either personal or enterprise,
loan_amount records the amount that the customer borrows from the bank,
loan_quota_left the loan quota left for the customer. A personal account can borrow at most 20,000 and an enterprise account can borrow at most 50,000,
net_value net value of the account (equal to withdrawable - loan_amount).
For every account, the client can perform the following actions: inquire, deposit, withdraw, save, transfer, loan and repay.
inquire When a personal or enterprise account is inquired, the balance of the account is displayed,
deposit A customer can deposit as much as he/she wants and can. After a deposit, the customer’s withdrawable, net_value and the bank’s total_deposits (see the bank manager section below) should be updated,
withdraw For a personal account, the customer can withdraw at most 2000 each time. For an enterprise account, the customer can withdraw at most 5000 each time. If a customer tries to withdraw an amount which exceeds this limit, a warning should be given. When a customer tries to withdraw an amount which exceeds the budget in that account, the withdraw fails and a warning should be given. Once a withdraw is successfully completed, the bank’s total_deposits should be updated.
transfer When transferring money, an enterprise account can transfer up to 20,000 while a personal account can transfer at most 10,000 each time. The withdrawable should be updated in the files if the transaction succeeds.
loan The bank offers a loan service to all its customers. The total borrowable amount from the bank is 100,000. Customers can borrow from the bank; if a customer wants to borrow an amount which exceeds the bank’s borrowable amount, a warning message should be given. Once money is loaned, the customer’s withdrawable, loan_amount and loan_quota_left and the bank’s borrowable_amount should be updated accordingly, and the data file should be updated accordingly as well.
repayment The customer is responsible for repayments. The customer must pay a loan interest rate, equal. to 5% for personal accounts, and 3% for enterprise accounts. For example, if a personal accounts borrows 100 from the bank, the customer should pay back 105 to the bank. Once finishing repayment, the customer’s loan_amount and loan_quota_left and the bank’s borrowable_amount and total_deposits should be updated accordingly.
change password The customer can change his/her password.
Use Case Demo
When the program starts, it requires the user to input his/her account number and password to log in.
Please input your account number:
If a valid account can be found in account.txt, the user can proceed to the next step. Otherwise, a warning will be given and the program will go back to the account input.
Please input your account password:
Verify the input using the account’s password stored in account.txt. If the password does not match, a warning will be given and the program will go back to the account input.
Once logged in successfully, the program should display the following function list:
- Inquiry
- Deposit
- Withdraw
- Transfer
- Loan
- Repay
- Change password
- Quit
Please select: - Inquiry
Outputs the balance as follows
Dear Alita, your balance is 100000.23 - Deposit
Inputs how much money the customer wants to deposit
Please input the amount to save: 10000
Verify if it is a valid amount, and then output the updated balance
Dear Alita, your balance has been updated to 110000.23 - Withdraw
Lets the user withdraw an amount of money
Please input the amount to withdraw: 10000
Verify if it is a valid amount, and output the updated balance. Otherwise a warning must be given.
Dear Alita, your balance has been updated to 100000.23 - Transfer
Lets the user transfer money to another account. The customer should input the number of the receiver account
Please input the target account number: 1002
Verify if it is a valid account. If not, a warning must be prompted. If yes, let the user input the amount to transfer
Please input the amount to transfer: 10000
Verify if it is a valid amount, and output the updated withdrawable amount. Otherwise a warning must be given.
Transfer success! Your withdrawable amount has been updated to 90000.23 - Loan
Lets the customer enter a loan. The user should input the desired amount to borrow.
Please input the loan amount: 1000
Verify that the amount is valid. If not, a warning message should be displayed. If yes, output the updated withdrawable and loan_quota_left entries.
Your withdrawable amount is now 91000.23
Your loan quota left is 19000 - Repayment
The program will automatically calculate the total amount to repay to the bank according to the customer’s loan amount and the bank’s loan interest. Verify if the customer has enough money. If yes, proceed with the repayment, and output the updated withdrawable amount. Otherwise a warning should be given. Note that on this example 89950.23 = 91000.23 - 1000*(1+0.05). After the customer’s repayment, the bank receives 1050 on this example, and the bank’s borrowable_amount is increased by that amount.
Cheers! Your loan amount is now 0. Your loan quota is now 20000.
Your withdrawable amount has been updated to 89950.23 - Change password
Please input your original password:
After this message, the customer should input his/her original password. If the password is wrong, then the password cannot be changed and a warning message is displayed. If the password is right, the next message below is displayed:
Please input your new password:
Please input your new password again:
The customer is required to input his/her new password twice. If the two passwords don’t match, the password is not changed, and a warning message is displayed. If they match, the password is changed and the following message is displayed:
Password updated successfully. - Continue/Quit After each operation, the following menu should be shown and implemented:
- Continue //Back to Operation menu
- Quit //Terminate the program
源码传送门
传送门:https://pan.baidu.com/s/1JJs9vbZahUCB6cQvXLgAVg?pwd=1111
标签:customer,account,12,loan,13,System,amount,password,bank From: https://www.cnblogs.com/codewriter/p/16977784.html