Answer:
The full program is below:
Full Restaurant Program
Here is the correct program, suitable for copying to a file and running. Hopefully you figured out the proper order for the lines. You should be able to read the program almost like a story in normal English.
import java.io.*;
import java.util.Scanner;
class RestaurantBill
{
public static void main (String[] args)
{
Scanner scan = new Scanner( System.in );
double basicCost;
System.out.print("Enter the basic cost: ");
basicCost = scan.nextDouble();
System.out.println("basic cost: " + basicCost + " total cost: " +
(basicCost + basicCost*0.06 + basicCost*0.20) );
}
}
As you read the story (the program) it should make sense. Actions should follow in a logical order. The logic is the important part, not the fussy details of syntax.
QUESTION 9:
There have been some big programming projects that failed badly, costing billions of dollars. What do you suppose is true:
- The projects failed because their programmers did not know syntax, or
- The projects failed because their logic was bad.