hourly wages
am i using the "final" constant value correctly?
i dont think i am... let me know please?
also one line of code is not compiling....
in the second part, testWork.
Work(double hours, double wage, double fedTax, double stateTax){
i am not sure why...
import chn.util.*;
import apcslib.*;
class Work{
privatedouble myHours;
privatedouble myWage;
finaldouble myFedTax;
finaldouble myStateTax;
Work(){
myWage = 1;
myHours = 1;
myStateTax = .15;
myFedTax = .04;
}
Work(double hours,double wage,double fedTax,double stateTax){
myHours = hours;
myWage = wage;
myFedTax = fedTax;
myStateTax = stateTax;
}
publicdouble calcGrossPay(){
return Math.round(myWage*myHours);
}
publicdouble calcFedTax(){
return Math.round(myFedTax*calcGrossPay());
}
publicdouble calcStateTax(){
return Math.round(myStateTax*calcGrossPay());
}
publicdouble calcNetPay(){
return Math.round(calcGrossPay() - calcStateTax() - calcFedTax());
}
}
import chn.util.*;
import apcslib.*;
publicclass testWork{
publicstaticvoid main(String[ ]args){
double wage, hours;
int choice = 2;
ConsoleIO keyboard =new ConsoleIO();
do{
System.out.println("Want to know how much you made this month?");
System.out.println("What's your hourly wage?");
wage = keyboard.readDouble();
System.out.println("How many hours did you work?");
hours = keyboard.readDouble();
Work jobA =new Work(wage, hours);
System.out.println("Gross Pay =" +"$" + jobA.calcGrossPay());
System.out.println("Federal Tax = " +"$" + jobA.calcFedTax());
System.out.println("State Tax =" +"$" + jobA.calcStateTax());
System.out.println("Net Pay =" +"$" + jobA.calcNetPay());
System.out.println("Have another job? Type 1 for Yes2 for No");
choice = keyboard.readInt();
}while (choice ==1);
System.out.println("See ya! Hope you get a raise!");
}
}

