-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountService.java
More file actions
62 lines (52 loc) · 1.47 KB
/
AccountService.java
File metadata and controls
62 lines (52 loc) · 1.47 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
61
62
package com.cg.service;
import java.util.Map;
import com.cg.bean.Account;
import com.cg.dao.AccountDAO;
import com.cg.dao.AccountDAOImpl;
public class AccountService implements Gst, Transaction{
AccountDAO dao=new AccountDAOImpl();
@Override
public double withdraw(Account ob, double amount) {
double new_balance=ob.getBalance()-amount;
if(new_balance<1000.00) {
new_balance=ob.getBalance();
System.out.println("Insufficient Balance");
}
ob.setBalance(new_balance);
return new_balance;
}
@Override
public double deposite(Account ob, double amount) {
// TODO Auto-generated method stub
double new_balance=ob.getBalance()+amount;
ob.setBalance(new_balance);
return new_balance;
}
@Override
public int transferMoney(Account from, Account to, double amount) {
// TODO Auto-generated method stub
double w=withdraw(from, amount);
deposite(to, amount);
return 1;
}
public boolean addAccount(Account ob) {
return dao.addAccount(ob);
}
public boolean updateAccount(Account ob) {
return dao.updateAccount(ob);
}
public boolean deleteAccount(Account ob) {
return dao.deleteAccount(ob);
}
public Account findAccount(Long mobileno) {
return dao.findAccount(mobileno);
}
public Map<Long, Account> getAllAccounts(){
return dao.getAllAccounts();
}
@Override
public double calculateTax(double PCT, double amount) {
// TODO Auto-generated method stub
return amount*Gst.PCT_5;
}
}