A good answer might be:

The answer is given below:


Adding in a Zero

Here is the complete program. The blanks have been filled, and the program layout improved somewhat. You can "copy-paste-and-run" this program.

import java.io.*;
class TaxProgram
{
  public static void main (String[] args) throws IOException
  {
     double taxRate = 0.05;
     BufferedReader stdin = 
        new BufferedReader ( new InputStreamReader( System.in ) );

    String inData;    
    int    price;
    double tax ;

    System.out.println("Enter the price:");
    inData = stdin.readLine();
    price  = Integer.parseInt( inData );     

    if ( price >= 100  )
      tax = price * taxRate;   
    else
      tax = 0;

    System.out.println("Item cost: " + price + 
        " Tax: " + tax + " Total: " + (price+tax) );    
  }
}

The program might look somewhat odd to you because the arithmetic expression (price+tax) will sometimes add a zero to price. This is fine. Sometimes it is easier to add in a zero than to do something special just to avoid adding it in. The program is shorter and easier to understand if the println statements are at the end.

QUESTION 13:

The user buys a shirt for $100 What will be printed on the monitor?