A good answer might be:Yes. It is a little awkward, however, because the user prompts as well as the computed answer will be sent to the output text file. | |
All Output gets sent to a FileHere is an example of redirecting the output of this file. Notice that the user does not see any prompts because they have been sent to the output file: Of course the output file does not get any of the characters that the user typed because they were sent to the program. To deal with this problem, programs are sometimes written to echo all user input:C:\users\default\JavaLessons>java Discount > discount.out 100 20 C:\users\default\JavaLessons>type discount.out Enter list price in cents: Enter discount in percent: Discount Price: 80 C:\users\default\JavaLessons>
| |
QUESTION 11:Is it a mistake that the echo lines use the variable line instead of the variables listPrice and discount? Click Here after you have answered the question |