A good answer might be:

Nothing. A file named output.txt in the current subdirectory will be replaced with a new file, but not a file in any other subdirectory.


Discount Program

Here is a (slightly) more realistic program that computes the discounted price, given the list price and the percentage discount:

import java.io.*;
class Discount
{
  public static void main ( String[] args ) throws IOException
  {
    int listPrice;
    int discount;
    int discountPrice;

    String line;
    BufferedReader stdin = new BufferedReader( 
        new InputStreamReader( System.in ) );

    System.out.println("Enter list price in cents:");
    line = stdin.readLine();
    listPrice = Integer.parseInt( line );

    System.out.println("Enter discount in percent:");
    line = stdin.readLine();
    discount = Integer.parseInt( line );

    discountPrice = listPrice - (listPrice*discount)/100 ;

    System.out.println( "Discount Price: " + discountPrice );
  }
}

Here is an example of the normal operation of this program:

C:\users\default\JavaLessons>java Discount

Enter list price in cents:
100
Enter discount in percent:
10
Discount Price: 90

C:\users\default\JavaLessons>

QUESTION 10:

Can the output of this program be redirected to a file?