go to previous page   go to home page   go to next page highlighting

Answer:

It was replaced with the new discount.out created for this run of the program.


Concatenation of Output to a File

Sometimes you want to run a program several times and put the output of all the runs into a single file. For example, say that you want the discounted price of several items to be saved in one file. Here is how to do this:

C:\temp>java DiscountErr > discount.out
Enter list price in cents: 100
Enter discount in percent: 10
Discount Price: 90

C:\temp>java DiscountErr >> discount.out
Enter list price in cents: 150
Enter discount in percent: 15
Discount Price: 128

C:\temp>java DiscountErr >> discount.out
Enter list price in cents: 200
Enter discount in percent: 30
Discount Price: 140

The double "greater than" signs >> mean to add the new output to the end of the file discount.out. This is called concatenation of the output to a file. Here is what the disk file now looks like:

C:\temp>type discount.out
Price in cents: 100
Discount: 10
Discount Price: 90
Price in cents: 150
Discount: 15
Discount Price: 128
Price in cents: 200
Discount: 30
Discount Price: 140

C:\temp>

QUESTION 15:

After all the above has been done, what would be the result of the command:

C:\temp>java Discount > discount.out

go to previous page   go to home page   go to next page