-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.java
62 lines (39 loc) · 893 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
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
/* Author: Param Mehta */
public class Account implements iAccounts {
String owner;
int accountNumber;
double balance;
public Account(String string, int i, double d) {
owner = string;
accountNumber = i;
balance = d;
}
public void deposit(double amount) {
this.balance += amount;
}
public double withdraw(double amount) {
if(this.balance - amount > 0){
this.balance -= amount;
return amount;
}
else
return -1;
}
public String displayAccount() {
return "Name: " + owner
+ "\n Account Number: " + getAccNum()
+ "\n Balance: " + getBalance() ;
}
public String getOwner() {
return owner;
}
public double getBalance() {
return balance;
}
public void setBal(double bal) {
balance = bal;
}
public int getAccNum() {
return accountNumber;
}
}