I was writing a program, which basically asked the user
for 3 inputs. A double input, an integer input, and a character
input (which was either a y or a n). The character input was used
for an IF statement.
Eventually I got the program to work, but it would only work if I did
the I put the following first:
c.out.println("Enter y if you pay VAT, n if you don't") ;
c = c.input.readChar( ) ;
Below this I had to put various c.out.prints and c.inputs with
regards to Doubles and Ints. However, when the above was put
third in the sequence, the program seemed to bypass
completely the IF statement. Indeed, the user is not able to
answer y or n. He can, however, do this if it's put first.
Can anyone explain why this is?
Another thing I've noticed is when, say, I do the following:
sum1 = total * num1
sum1= total * num2
Obvously this just made up, but I've noticed that if, for example,
total is used 'twice' (as seen above) that JAVA does not accept
this. Why is this?
BTW...the ConsoleWindow is used for the user to input data.
Thanks everyone.
I really appreciate the time and help you've all given me so far.