Question
Hello this is C++ project pls help Wallet Following the class diagram shown below, create the class Wallet. A Wallet represents a carrier of bills
Hello this is C++ project pls help
Wallet
Following the class diagram shown below, create the class Wallet. A Wallet represents a carrier of bills and coins. You use your wallet to pay for things, which reduces the balance held inside. When you visit an ATM, you can fill it back up with cash again. A sample driver for this class is shown below. You should probably make a more thorough driver to test your class better. I will have my own driver which will aim to exploit any possible edge cases.
Wallet Class Description
Wallet( );
Wallet( int d, int c );
int getDollars( );
int getCents( );
bool canPayFor( int dollarAmount, int centsAmount );
void payFor( int dollarAmount, int changeAmount );
void visitATMForCash( int dollarAmount );
int dollars; int cents;
Wallet Sample Driver Code
int atm = 0, d = 0, c = 0, x = 0, y = 0; char cont = 'y';
cout << "Hello, how much money do you have in your wallet?" << endl; cout << "Dollars: ";
cin >> d; cout << "Cents: "; cin >> c;
cout << endl;
Wallet w(d, c);
cout << "How many dollars would you like to withdraw from the ATM? ";
cin >> atm;
w.visitATMForCash(atm);
cout << "Currently you have: " << endl;
cout << "Dollars: " << w.getDollars() << endl << "Cents: " << w.getCents() << endl << endl;
Sample Driver Output
Hello, how much money do you have in your wallet? Dollars: 10 Cents: 0 How many dollars would you like to withdraw from the ATM? 5 Currently you have: Dollars: 15 Cents: 0 How much are you going to spend? Dollars: 6 Cents: 56 You now have: Dollars: 8 Cents: 44 Are you spending more money (y/n)? y How much are you going to spend? Dollars: 10 Cents: 0 Sorry, you do not have enough money to spend. Please spend less. Are you spending more money (y/n)? n You have this amount left in your wallet: Dollars: 8 Cents: 44
Your submission should follow this organization:
-main.cpp this is your driver file
-wallet.h
-wallet.cpp
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