The new improved program follows.
Your program should look much like the following:
import java.util.Scanner; public 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.
If the println
statement were not changed, would the
Public Health Department give your program a passing grade?