[Solved] Java: ERROR variable scopes in if statements
The reason you are getting the error is that some execution paths in your code do not set a value to hours. It is difficult to see this problem because you are mixing input validation with result calculation logic. You could just initialize hours to 0, but I suspect that your program still won’t work … Read more