//Libraries I need
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
//Functions
void showBallance();
void dePosit(double amount);
void WithDraw(double amount);
void quit();
using namespace std;
//Main Variable(The user's ballance)
double ballance = 0.00;
int main()
{
do{
int answer;
cout << "Choose what you want me to do:\n";
cout << "1. Show Ballance\n";
cout << "2. Deposit\n";
cout << "3. Withdraw\n";
cout << "4. Exit\n";
cin >> answer;
switch(answer){
case 1: showBallance();
break;
case 2:
double amount;
cout << "How much money do you want to deposit? (Max: $400)\n";
cin >> amount;
if (amount > 400)
{
cout << "You can't deposit more money than maximum. Try again.";
cin >> amount;
}
else {
dePosit(amount);
}
break;
case 3:
double yoanswer;
cout << "How many money do you want to withdraw from your bank account? (Your ballance currently is " << ballance << ")";
cin >> yoanswer;
WithDraw(double yoanswer);
break;
case 4:
quit();
break;
default: cout << "I can't understand you. Goodbye.";
quit();
break;
}
}while (answer != 4);
return 0;
}
void showBallance()
{
cout << "Your ballance is " << ballance << ". If you wish to add more money to your bank account there is an option to deposit.\n";
return 0;
}
void dePosit(double amount)
{
ballance += amount;
cout << "Your ballance currently is " << ballance << ".\n";
return 0;
}
void WithDraw(double amount)
{
ballance -= amount;
if (ballance < 0)
{
cout << "You can't withdraw more money that is on your bank account.\n";
}
return 0;
}
void quit()
{
exit();
}