Hi. I’ve just gone through appendix A.4 in Think Java, a book that @P1xt recommended, and I’m trying to test the output of the Convert function as the text directs.
Towards that goal, I cloned the ThinkJavaCode repo into my computer, entered the ch03 folder, and compiled the Convert file, all successfully. I then used the command line to create test.in and test.exp, as the book instructs.
I gave test.in the contents “193.04” and test.exp the contents “193.04 cm = 6 ft, 4 in”, again as instructed.
Finally, I typed the command
java Convert < test.in > test.out,
again as instructed.
At this point, I should have a test.out file that has exactly the same contents as my test.exp file. But that’s not what I’m getting. For some reason, test.out is giving me the content “Exactly how many cm? 193.04 cm = 6 ft, 4 in”.
In other words, it’s adding the prompt to the output, which is incorrect. Why is this? I would much appreciate any help that can be offered.