Please help me with the code. Thank you!
Description
James Vond has delivered us some intel that the enemy perpetrators have been tricked into going to a bank that we've wired and booby-trapped. However, we have not gotten a bank system in place and you are the only person who is capable of handling such a task. We need this plan to go off without a hitch because the money we'll be receiving will give us insight on the hideout's whereabouts. We are counting on you.
Signed, M
Objective
You will design a functioning bank system that will have functions that allows a user to withdraw, deposit, and check to see how much money is currently in their account. A main menu has already been created, so all that's left is for you to implement the functions.
Requirements
Sorry, negative amounts are prohibited.
Other Helpful Information
#include <iostream>
#include <iomanip>
using namespace std;
static float balance = 3647.72;
/*datatype*/ withdraw(/*parameter*/){
//implement your code here
}
/*datatype*/ deposit(/*parameter*/){
//implement your code here
}
/*datatype*/ checkBal(){
//implement your code here
}
int main() {
int choice;
do{
cout <<
"---------------------------------\n\tMAIN
MENU\n---------------------------------\n";
cout << "\n1) Withdraw
Money";
cout << "\n2) Deposit
Money";
cout << "\n3) Check
Balance";
cout << "\n4) Exit";
cout << "\nPlease enter your
desired number: \n";
cin >> choice;
switch(choice){
case 1:
cout << "Enter the amount: $\n";
//some code & function call here
break;
case 2:
cout << "Enter the amount: $\n";
//some code & function call here
break;
case 3:
//function call here
break;
case 4:
cout << "Good-bye.";
break;
}
}while(choice!=4);
return 0;
}
Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
#include <iostream>
#include <iomanip>
using namespace std;
static float balance = 3647.72;
//method to withdraw money
void withdraw(float amount){
//validating amount
if(amount<0){
//negative
cout<<"Sorry, negative amounts are prohibited."<<endl;
}else{
//checking if amount exceeds balance
if(amount>balance){
//displaying a message
cout<<"Amount is greater than balance, withdrawing available amount"<<endl;
//setting amount to whatever left in balance
amount=balance;
}
//subtracting amount from balance
balance-=amount;
//displaying amount withdrawn and new balance
cout<<"$"<<amount<<" has been withdrawn"<<endl;
cout<<"You have $"<<balance<<" left in your account."<<endl;
}
}
//method to deposit amount to balance
void deposit(float amount){
//validating amount
if(amount<0){
//negative
cout<<"Sorry, negative amounts are prohibited."<<endl;
}else{
//updating balance,
balance+=amount;
//displaying deposited amount and printing new balance
cout<<"$"<<amount<<" has been deposited"<<endl;
cout<<"You have $"<<balance<<" left in your account."<<endl;
}
}
//method to print balance
void checkBal(){
//displaying balance amount
cout<<"Your balance is $"<<balance<<endl;
}
int main() {
//setting a fixed precision of 2 digits after decimal point
cout<<setprecision(2)<<fixed;
int choice;
float amt;
do{
cout << "---------------------------------\n\tMAIN MENU\n---------------------------------\n";
cout << "\n1) Withdraw Money";
cout << "\n2) Deposit Money";
cout << "\n3) Check Balance";
cout << "\n4) Exit";
cout << "\nPlease enter your desired number: \n";
cin >> choice;
switch(choice){
case 1:
cout << "Enter the amount: $\n";
//getting amount and withdrawing
cin>>amt;
withdraw(amt);
break;
case 2:
//getting amount and depositing
cout << "Enter the amount: $\n";
cin>>amt;
deposit(amt);
break;
case 3:
//checking balance
checkBal();
break;
case 4:
cout << "Good-bye.";
break;
}
}while(choice!=4);
return 0;
}
/*OUTPUT*/
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
3
Your balance is $3647.72
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
1
Enter the amount: $
2000.44
$2000.44 has been withdrawn
You have $1647.28 left in your account.
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
2
Enter the amount: $
1234.555
$1234.56 has been deposited
You have $2881.83 left in your account.
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
1
Enter the amount: $
5000
Amount is greater than balance, withdrawing available amount
$2881.83 has been withdrawn
You have $0.00 left in your account.
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
2
Enter the amount: $
-123
Sorry, negative amounts are prohibited.
---------------------------------
MAIN MENU
---------------------------------
1) Withdraw Money
2) Deposit Money
3) Check Balance
4) Exit
Please enter your desired number:
4
Good-bye.
Please help me with the code. Thank you! Description James Vond has delivered us some intel...
Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...
C++ Check Book Program I need to have a checkbook program that uses the following items. My code that I have appears below. 1) Math operations using built-in math functions 2) Class type in a separate .h file with member functions (accessor functions, get, set, show, display find, etc). There needs to be an overloaded function base/derived classes or a template. 3) Binary File #include <iostream> using namespace std; int main() { double checking,savings; cout<<"Enter the initial checking...
using the source code at the bottom of this page, use the following instructions to make the appropriate modifications to the source code. Serendipity Booksellers Software Development Project— Part 7: A Problem-Solving Exercise For this chapter’s assignment, you are to add a series of arrays to the program. For the time being, these arrays will be used to hold the data in the inventory database. The functions that allow the user to add, change, and delete books in the store’s...
I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...
I'm getting this error message, and trying to figure out why. Check 1 failed Output: What would you like to do? Expected: What would you like to do? Thank you for banking with us. ATM Summary Your final function in the ATM Script is the Print the Customer summary as follows: Final Input userchoice = input ("What would you like to do?\n") userchoice = 'Q' Final Output What would you like to do? Thank you for banking with us. ATM...
Textual menus work by showing text items where each item is numbered. The menu would have items 1 to n. The user makes a choice, then that causes a function to run, given the user made a valid choice. If the choice is invalid an error message is shown. Whatever choices was made, after the action of that choice happens, the menu repeats, unless the menu option is to quit. Such kind of menus are displayed from the code under...
Can I get some help with this question for c++ if you can add some comments too to help understand that will be much appreciated. Code: #include <cstdlib> #include <getopt.h> #include <iostream> #include <string> using namespace std; static long comparisons = 0; static long swaps = 0; void swap(int *a, int *b) { // add code here } void selectionSort(int *first, int *last) { // add code here } void insertionSort(int *first, int *last) { // add code here }...
/*Colesha PearmanCIS247CATM ApplicationMay 4,2020*///Bring in our libaries#include"stdafx.h" #include<iostream>#include<conio.h>#include<string>#include<fstream>//read/write to files#include<ctime>//time(0)#include<iomanip>//setpresision stdusing namespace std; //create constant vaules-- cannot be changedconst int EXIT_VALUE = 5;const float DAILY_LIMIT = 400.0f;const string FILENAME = "Account.txt"; //create balance variabledouble balance = 0.0; //prototypesvoid deposit(double* ptrBalance);void withdrawal(double* ptrBalance, float dailyLimit); //overloaded method-this verision does not take withdrawal amount void withdrawal(double* ptrBalance, float dailyLimit, float amount); //overloaded method that takes withdrawal amount ///Enrty point to the application int main(){ //look for the starting balance; otherwise generate a random balance ifstream...
C++ EXERCISE (DATA STRUCTURES). I just need a code for some functions that are missing. Please help me figure out. Thanks. C++ BST implementation (using a struct) Enter the code below, and then compile and run the program. After the program runs successfully, add the following functions: postorder() This function is similar to the inorder() and preorder() functions, but demonstrates postorder tree traversal. displayParentsWithTwo() This function is similar to the displayParents WithOne() function, but displays nodes having only two children....
Calculate the Balance - Withdrawal If the action is Withdrawal ‘W’, use the withdrawal function to remove funds from the account Hint – The formatter for a float value in Python is %f. With the formatter %.2f, you format the float to have 2 decimal places. For example: print("Account balance: $%.2f" % account_balance) Withdrawal Information Withdraw Input userchoice = input ("What would you like to do?\n") userchoice = 'W' withdrawal_amount = 100 Withdraw Output What would you like to do?...