-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
37 lines (28 loc) · 780 Bytes
/
Account.java
File metadata and controls
37 lines (28 loc) · 780 Bytes
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
package com.jspiders.multithreading.account;
public class Account {
int balance;
public Account(int balance) {
this.balance=balance;
}
//withdraw
public void Withdraw(int amount) {
if (balance>amount) {
balance-=amount;
System.out.println(amount + " RS. Withdraw successfully");
}
else {
System.out.println("insufficient balance");
}
System.out.println("The Current balance is:" + this.checkBalance());
}
//deposit
public void Deposit(int amount) {
balance =balance + amount;
balance +=amount;
System.out.println(amount + "RS. DEPOSITED SUCCESSFULLY");
System.out.println("The current balance is:" +this.checkBalance());
}
int checkBalance() {
return balance;
}
}