A good answer might be:

The new improved program follows below.


New, Improved Restaurant Program

Your program should look like the following, although in this version a few extra blank lines were added, and a few other cosmetic changes were made.

import java.io.*;
class RestaurantBill
{
  public static void main (String[] args) 
      throws IOException

  {
    String charData;
    double basicCost;

    String tipData;
    double tipRate;

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

    System.out.println("Enter the basic cost:");
    charData   = stdin.readLine();
    basicCost  = ( Double.valueOf( charData  ) ).doubleValue();

    System.out.println("Enter the tip rate:");
    tipData    = stdin.readLine();
    tipRate    = Double.parseDouble( tipData )  ;

    System.out.println("basic cost: " + basicCost + 
        " total cost: " + 
        (basicCost + basicCost*0.06 + basicCost*tipRate));
  }
}

The println statement was changed to use the variable tipRate. Without this change, the program would run, and would appear to work correctly, but would not calculate the correct result.

QUESTION 8:

If the println statement were not changed, would the Public Health Inspector give your program a passing grade?