+ 1

Why is state and federal tax not calculating when prompted to in the program?

https://code.sololearn.com/ccWJDcps262v/?ref=app

16th Jun 2019, 3:08 PM
Safina Nganga
Safina Nganga - avatar
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)),
16th Jun 2019, 6:56 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
https://code.sololearn.com/ccWJDcps262v/?ref=app here is the code in full form sorry was having a hard time with it
16th Jun 2019, 4:03 PM
Safina Nganga
Safina Nganga - avatar
+ 1
sorry i guess my question is why isnt the program calculating the state tax after it prompts for it?
16th Jun 2019, 4:15 PM
Safina Nganga
Safina Nganga - avatar
+ 1
i did the code is here check it gor yourself https://code.sololearn.com/ccWJDcps262v/?ref=app
16th Jun 2019, 4:25 PM
Safina Nganga
Safina Nganga - avatar
+ 1
what do i do about the tax percentage
16th Jun 2019, 6:37 PM
Safina Nganga
Safina Nganga - avatar
+ 1
to get it to calculate the state tax and federal tax
16th Jun 2019, 6:41 PM
Safina Nganga
Safina Nganga - avatar
+ 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
16th Jun 2019, 6:55 PM
Safina Nganga
Safina Nganga - avatar
+ 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
16th Jun 2019, 10:54 PM
zemiak
0
so how do go about it ?
16th Jun 2019, 6:13 PM
Safina Nganga
Safina Nganga - avatar