Jump to content

Very very very basic java math problem

Go to solution Solved by Mira Yurizaki,

You're missing an operator between (wage * hours) and (-tax). Most programming languages don't take a closing parenthesis followed by an opening parenthesis to imply a multiplication.

 

EDIT: What you probably wanted to do was (wages * hours) - tax

Why won't this line work? https://pastebin.com/Fj7kwsum

        System.out.println("Net pay "+ (wage*hours) (-tax));

I am very shaky as I learned this today and I have a test on it tomorrow ._.

 

Can anyone help me understand why this wont work, and what I would need to do to fix it?

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
https://linustechtips.com/topic/799580-very-very-very-basic-java-math-problem/
Share on other sites

Link to post
Share on other sites

You're missing an operator between (wage * hours) and (-tax). Most programming languages don't take a closing parenthesis followed by an opening parenthesis to imply a multiplication.

 

EDIT: What you probably wanted to do was (wages * hours) - tax

Link to post
Share on other sites

9 minutes ago, M.Yurizaki said:

You're missing an operator between (wage * hours) and (-tax). Most programming languages don't take a closing parenthesis followed by an opening parenthesis to imply a multiplication.

 

EDIT: What you probably wanted to do was (wages * hours) - tax

I tried that, it throws me this error:

wait what the hell

I did this and it wont throw me any errors

        System.out.println("Net pay "+ ((wage * hours) - tax));
WHY DOES THIS WORK?!?! it has an extra bracket and is CLEARLY a syntax error!!! LOOK!!! UNCLOSED BRACKET-- oh

 

nevermind

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to post
Share on other sites

19 minutes ago, babadoctor said:

Why won't this line work? https://pastebin.com/Fj7kwsum


        System.out.println("Net pay "+ (wage*hours) (-tax));

I am very shaky as I learned this today and I have a test on it tomorrow ._.

 

Can anyone help me understand why this wont work, and what I would need to do to fix it?

 

((40(10)).7)=280

this assumes 40 hours at 10dollars with 30%tax rate

System.out.println((hours(wage))taxrate)=netpay

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×