exception handling
Hi,
I have the following problem with my code. I am getting this message when I compile:
Tax.java:86: expetion java.rmi.RemoteException is never thrown in body of corresponding try statement
catch(RemoteException e){}
Tax.java:87: missing return statement }
Can you please help.
Tax.java
import java.rmi.*;
import java.rmi.server.*;
import java.lang.*;
import java.util.*;
publicclass Taxextends UnicastRemoteObjectimplements TaxInterface{
double perAmt, fedTax, limit1, limit2, limit3, limit4, totalInc, expense, TI;
public Tax(){
//try{}
//catch(RemoteException e){}
}
publicdouble calculateFederalTax(double totalI,double expen,int year)throws RemoteException{
try{
totalInc = totalI;
expense = expen;
if (year == 1){
limit1 = 0;
limit2 = 32183;
limit3 = 64368;
limit4 = 104648;
perAmt = 7746;
TI = totalInc - perAmt - expense;
if (TI < 0){
fedTax = 0;
}
if (TI > 0 && TI <= 32183){
fedTax = 0.16 * TI;
}
if (TI > 32183 && TI <= 64368){
fedTax = 5149 + 0.22 * (TI - 32183);
}
if (TI > 64368 && TI <= 104648){
fedTax = 12230 + 0.26 * (TI - 64368);
}
if (TI > 104648){
fedTax = 22703 + 0.29 * (TI - 64368);
}
}
if (year == 2){
limit1 = 0;
limit2 = 33183;
limit3 = 62377;
limit4 = 105099;
perAmt = 7832;
if (expense > 5000){
System.out.println(
"Sorry, the system can not calculate your federal income tax.");
}
if (expense <= 5000){
TI = totalInc - perAmt - expense;
if (TI < 0){
fedTax = 0;
}
if (TI > 0 && TI <= 33183){
fedTax = 0.16 * TI;
}
if (TI > 33183 && TI <= 62377){
fedTax = 5149 + 0.22 * (TI - 32183);
}
if (TI > 62377 && TI <= 105099){
fedTax = 12230 + 0.26 * (TI - 64368);
}
if (TI > 105099){
fedTax = 22703 + 0.29 * (TI - 64368);
}
}
}
return fedTax;
}
catch(RemoteException e){}
}
}
TaxInterface.java
import java.rmi.*;
publicinterface TaxInterfaceextends Remote{
publicdouble calculateFederalTax(double totalI,double expen,int year)throws RemoteException;
}

