Answer:

The new improved program follows.

New, Improved Restaurant Program

Your program should look much like the following:

import java.io.*;
import java.util.Scanner;

class RestaurantBill
{
  public static void main (String[] args)  
  {
    Scanner scan = new Scanner( System.in );
    double basicCost;
    double tipPercent;

    System.out.print("Enter the basic cost: ");
    basicCost = scan.nextDouble();
    System.out.print("Enter the tip percentage: ");
    tipPercent = scan.nextDouble();

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

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 11:

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