+ 1
Why is state and federal tax not calculating when prompted to in the program?
15 Respuestas
+ 5
Your methods returns tax, federal tax etc. Means you can assign it to a variable. Or just print it in your main method.
In your main method:
Create an object:
EmployeeType e = new EmployeeType(12, 2);
System.out.println(e.state_tax(2.5,3.0)),
+ 1
https://code.sololearn.com/ccWJDcps262v/?ref=app
here is the code in full form sorry was having a hard time with it
+ 1
sorry i guess my question is why isnt the program calculating the state tax after it prompts for it?
+ 1
i did the code is here check it gor yourself
https://code.sololearn.com/ccWJDcps262v/?ref=app
+ 1
what do i do about the tax percentage
+ 1
to get it to calculate the state tax and federal tax
+ 1
so after the part you prompt for state tax percentage for example, it scans it in but where it calculates it on the next line it doesnt return the state tax value? and i cant figure out why
+ 1
// in class EmployeeType
double state_tax(double pay, double p) {
return pay * p * 0.01;
}
double federal_tax(double pay, double p) {
return pay * p * 0.01;
}
// in main()
System.out.println("Enter state tax percentage");
double state_tax_percentage = sc.nextDouble();
double state_tax = et.state_tax(payroll, state_tax_percentage);
System.out.println(" state tax " +state_tax);
System.out.println("Enter federal_tax percentage");
double federal_tax_percentage = sc.nextDouble();
double federal_tax = et.federal_tax(payroll, federal_tax_percentage);
System.out.println(" federal tax "+federal_tax);
ps. I didn't care if you calculate it right
0
so how do go about it ?