C++ ONLY, NO JAVA USING CODEBLOCKS WRITE IN BASIC C++ Assignment Description: In
ID: 3690506 • Letter: C
Question
C++ ONLY, NO JAVA
USING CODEBLOCKS
WRITE IN BASIC C++
Assignment Description:
In this assignment you will create a program that allows a user to choose one of the following main menu items:
C) Create new user account (Create an account with userId/password)
L) Login
V) View promotions
Q) Quit the program
If User enters an option other than (uppercase or lowercase) C, L, V, or Q, the program does not do anything and shows a message wrong option and displays the menu again.
When user enters option C, the program asks the user to enter a userId and a password and successfully returns back to the main menu. The login and password should be stored in a file.
If the user chooses option L, the program will display the login prompt and then, it will ask for the password. At this stage, the entered login and password are compared to the stored login/password pair and proper message will show up if the match was not found which takes the user back to the main menu.
If the user chooses option V, the program will display the message: Thank you for using our bank and Future Computer Programmer ATM Machine! For your continued support, we are offering 3% cash back on all debit purchases.
Now, if login was successful, the following banking menu will be display to let the user choose one of the following tasks:
W) Withdraw money.
D) Deposit money.
B) Request balance.
Q) Quit the program.
(again, remember that if the user enters an option other than (uppercase or lowercase) W, D, B, Q, the program should show a message and display the menu again.)
The initial balance for the user account should be $0.00
If the user chooses option W, the program should ask the user to enter amount user wishes to withdraw.
Validation: In the case of withdraw, if the amount is more than balance the user should be notified and no withdraw will occur.
If the user chooses option D, the program should ask the user how much amount the user wishes to deposit and add it to initial balance.
If the user chooses option B, the program should display the balance amount in the user account.
Sample Output:
Hi! Welcome to Future Computer Programmer ATM Machine!
Please select an option from the menu below:
l -> Login
c -> Create New Account
v -> View promotions
q -> Quit
Enter your choice: L
Please enter your user id: 12
Please enter your password: 2345
No match was found! Login Failed!
Please select an option from the menu below:
l -> Login
c -> Create New Account
v -> View promotions
q -> Quit
Enter your choice: c
Please enter your user name: 12
Please enter your password: 2345
Thank You! Your account has been created!
Please select an option from the menu below:
l -> Login
c -> Create New Account
v -> View promotions
q -> Quit
Enter your choice: l
Please enter your user id: 12
Please enter your password: 2345
Access Granted! Transferring to Account Menu!
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: d
Enter amount of deposit: $20
$20 was deposited.
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: B
Your balance is $20.
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: W
Enter amount of withdrawal: $25
Sorry withdrawal amount exceeds the balance. Can’t withdraw !
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: W
Enter amount of withdrawal: $2.5
$2.5 was withdrawn
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: b
Your balance is $17.5.
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: R
Date and Time Transaction Amount Status
Sun Mar 20 12:48:18 2016 Deposit $20 OK
Sun Mar 20 12:52:41 2016 Check Balance $20 OK
Sun Mar 20 12:54:31 2016 Withdraw Req $25 Not OK
Sun Mar 20 12:55:57 2016 Withdraw Req $2.5 OK
Sun Mar 20 12:57:08 2016 Check Balance $17.5 OK
Please select an option from the menu below
d -> Deposit Money
w -> Withdraw Money
b -> Check Balance
r -> Review Account Activities History
q -> Quit
Enter your choice: Q
Log Out Successful!
Please select an option from the menu below:
l -> Login
c -> Create New Account
v -> View promotions
q -> Quit
Enter your choice: Q
Thanks for stopping by!
Additional Instructions:
All transactions should be stored in a file called transHistory.output as shown above for the Review Account Activities History.
NOTE: Do Not Use Excessive Global Variables. Using Global Variables in most functions may result in losing points for the designated function.
Choose the parameters and return types that you feel are right for the appropriate methods. Again, do not use an excessive amount of Global Variables, as you will lose points.
Please make sure your code has following functions:
char mainMenu(); //main menu, first thing the user sees. Displays the menu and gets the value for selection
void createAccount(); //will only display if the user has selected to create an account. Allows the user to enter his/her ID and password and then stores this login information in a file called accounts.txt
void login(); //this function gets the user name and password from the user. Must then match this account info, by comparing it to every item in the file accounts.txt, to indicate whether or not login was successful
char bankingMenu(): //will only display if the user has selected to log in.
void deposit (); //allows the user to put money into their accounts, prints success or fail upon deposit
void withdraw(); //allows the user to get money from their accounts, prints success or fail upon deposit
void displayBalance(); //shows the balance on the screen
void ShowTransHist(); //get the transaction history from the file path string and display
You can use additional functions (optional) for input validation and withdrawal amount validation. Your program should make use appropriate switch and if-else statements where necessary.
Make sure you work out an algorithm and submit it as well either in the form of pseudo-code or flowchart before you start implementing the code. You can include your pseudo code within the block comment/header documentation part of the code. A pseudo code/algorithm should consist of clear and concise steps that mirror your implementation logic.
Explanation / Answer
#include 02 #include 03 #include 04 #include // for exit(1); 05 06 using namespace std; 07 08 09 void Login(); 10 11 int main() 12 { 13 Login(); 14 return 0; 15 } 16 17 void Login() 18 { 19 char login_un[50], login_pw[50], username[50], password[50]; 20 int c; 21 ifstream uin("user.txt"); 22 ifstream pin("pass.txt"); 23 24 coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.