-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankSystem.cxx
More file actions
68 lines (66 loc) · 1.31 KB
/
BankSystem.cxx
File metadata and controls
68 lines (66 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
using namespace std;
class Bank
{
private:
float balance = 0;
public:
Bank()
{
cout << "Welcome to The Bank of Torres" << endl;
}
void selectMenu()
{
int choice;
cout << "1. View Account Balance\n";
cout << "2. Deposit\n";
cout << "3. Withdraw\n";
cout << "4. Exit Bank\n";
cin >> choice;
if (choice == 1)
viewBalance();
else if (choice == 2)
depositMoney();
else if (choice == 3)
withdrawMoney();
else if (choice == 4)
exit(0);
else
cerr << "Invalid input\n";
}
void viewBalance()
{
cout << "Available Account Balance is: "
<< "$" << balance << endl;
cout << endl;
selectMenu();
}
void depositMoney()
{
cout << "Enter the amount you want to deposit: \n";
float deposit;
cin >> deposit;
balance = balance + deposit;
cout << "You deposited $" << deposit << " into your account." << endl;
cout << endl;
selectMenu();
}
void withdrawMoney()
{
cout << "Enter the amount you want to withdraw: \n";
float withdraw;
cin >> withdraw;
balance = balance - withdraw;
cout << "You withdrew $" << withdraw << " from your account." << endl;
cout << endl;
selectMenu();
}
};
int main()
{
Bank *account1 = new Bank;
account1->selectMenu();
delete account1;
// Code Written By ERIK TORRES
// Email : e.torres5732@student.tsu.edu
}