-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.java
30 lines (26 loc) · 974 Bytes
/
Account.java
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
public class Account {
public int accountNumber;
public String accountHolder;
public double balance;
public Account(int accountNumber, String accountHolder, double balance) {
this.accountNumber = accountNumber;
this.accountHolder = accountHolder;
this.balance = balance;
}
public void deposit(double amount) {
balance += amount;
}
public void withdraw(double amount) {
if (amount <= balance) {
balance -= amount;
System.out.println("Withdrawal of " + amount + "Tk successful. New balance: " + balance + "TK.");
} else {
System.out.println("You don't have sufficient balance.");
}
}
public void AccountDetails() {
System.out.println("Account Number: " + accountNumber);
System.out.println("Account Holder: " + accountHolder);
System.out.println("Balance: " + balance + "Tk.");
}
}