forked from neiljaviya/hostel-app-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccountManager.java
More file actions
57 lines (48 loc) · 1.19 KB
/
accountManager.java
File metadata and controls
57 lines (48 loc) · 1.19 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
public abstract class BankAccount
{
public String accountnumber;
public String ownername;
public double balance;
public double deposite(double amount)
{ return balance += amount; };
public double withdraw(double amount)
{ return balance -= amount; };
public String getOwnername() {
return ownername;
}
public void setOwnername(String ownername) {
this.ownername = ownername;
}
public double getBalance() {
return balance;
}
}
public class SavingsAccount extends BankAccount
{
public void withdraw(double amount)
{ if(getBalance()-amount >= 0)
{ balance -= amount;
System.out.println(amount + "Withdraw");}
else
{System.out.println("Invalid Input");}
}
}
public class CheckingAccount extends BankAccout
{
public void withdraw(double amount)
{ if(getBalance()-amount >= 0)
{ balance -= amount;
System.out.println(amount + "Withdraw");}
else
{System.out.println("Invalid Input");}
}
}
public class Main
{
public static void main(String args[])
{ BankAccount b = new BankAccoutn();
b.balance = 25000;
System.out.println(b.withdraw = 1000);
System.out.println(b.deposite = 5000);
}
}