Collie Mason wrote:Thank you! I called the playGame() method in toString(), and it cleared up my issue. However, now "computer" is only being assigned as 1, not somewhere in the range between 1 and the user's input (assigned as "upperBound"). How can I fix this?
I appreciate the suggestion with random.nextInt(), and I may use that in future code.
Jay Rex wrote:1. Why is it that if I enter 99.99, it enters the if loop and prints "Please enter a valid number". 99.99 is not greater than 99.99.
Jay Rex wrote:2. I am new to try catch blocks. I see that they have block scope. Lines 18 and 24 are duplicated, as it appears I have to check the code inside the try block and then duplicate the code outside the try catch block because that is what I want to do. Is this the correct way to do it?
Stephan van Hulst wrote:To further clarify what Paweł wrote, the value you are using to create the BigDecimal instance with is not actually -0.206, but the closest value that can be represented by the double datatype.