📄 bankserverinterfaceimpl.java
字号:
import java.rmi.*;
import java.rmi.server.*;
import java.sql.SQLException;
import java.util.*;
public class BankServerInterfaceImpl extends UnicastRemoteObject implements BankServerInterface{
private Bank thebank;
public BankServerInterfaceImpl() throws RemoteException{
thebank = new Bank();
// thebank.readCustomers();
}
public double findBalance(String No,String pin) throws RemoteException{
try{
return thebank.findCustomer(No, pin).getBalance();
}
catch(SQLException ex){
System.out.println(ex);
return -1;
}
}
public boolean findAccount(String No,String pin) throws RemoteException{
try{
if(thebank.findCustomer(No, pin)!=null)
return true;
else
return false;
}
catch(Exception ex){
System.out.println(ex);
return false;
}
}
public boolean withdraw(String No,String pin,double num) throws RemoteException{
try{
return thebank.findCustomer(No, pin).withdraw(num);
}
catch(SQLException ex){
System.out.println(ex);
return false;
}
}
public boolean deposit(String No,String pin,double num) throws RemoteException{
try{
return thebank.findCustomer(No, pin).deposit(num);
}
catch(SQLException ex){
System.out.println(ex);
return false;
}
}
public boolean deposit(String No,double num) throws RemoteException{
try{
return thebank.deposit(No,num);
}
catch(SQLException ex){
System.out.println(ex);
return false;
}
}
public boolean changepin(String No,String pin,String newpin) throws RemoteException{
try{
return thebank.findCustomer(No, pin).changepin(newpin);
}
catch(SQLException ex){
System.out.println(ex);
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -