go to previous page   go to home page   go to next page hear noise

Answer:

The new improved program follows.


New, Improved Restaurant Program

Your program should look much like the following:

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 now uses the variable tipPercent, which contains the percentage the user wishes to tip.


QUESTION 11:

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