-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_3.cpp
More file actions
60 lines (60 loc) · 1.43 KB
/
2_3.cpp
File metadata and controls
60 lines (60 loc) · 1.43 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
#include <iostream>
#include <string>
using namespace std;
class Account
{
private:
string name;
string accountno;
double balance;
public:
Account(string n, string no, double b = 5000)
{
name = n;
accountno = no;
balance = b; // Corrected this line
}
void deposite(double amount) // to deposit the amount
{
balance += amount; // Update the balance
cout << "Account No :" << accountno << endl;
cout << "Deposited Amount :" << amount << endl;
cout << "Total Bank Balance :" << balance << endl;
cout << "\n" << endl;
}
void withdraw(double amount) // for withdraw
{
if (amount <= balance) // to avoid the problem of insufficient balance
{
balance -= amount; // Update the balance
cout << "Account No :" << accountno << endl;
cout << "Withdrawn Amount :" << amount << endl;
cout << "Total Bank Balance :" << balance << endl;
cout << "\n" << endl;
}
else
{
cout << "Account No :" << accountno << endl;
cout << "Error insufficient balance" << endl;
cout << "\n" << endl;
}
}
void display()
{
cout << "Account Holder Name :" << name << endl;
cout << "Account No :" << accountno << endl;
cout << "Total Balance :" << balance << endl;
cout << "\n\n" << endl;
}
};
int main()
{
Account A1("pushti", "24CE052", 45123);
A1.deposite(1564);
A1.display();
Account A2("Reeva", "24CE026");
A2.withdraw(1200);
A2.display();
cout<<"24CE052_pushti kansara";
return 0;
}