A good answer might be:

The full program is below:

Full Restaurant Program

Here is the correct program, suitable for "copy-paste-and-run." Hopefully figuring out the proper order for the lines was not difficult. You should be able to almost "read" the program, like English text.

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

  {
    String charData;
    double basicCost;
    BufferedReader stdin = 
        new BufferedReader ( 
        new InputStreamReader( System.in ) );

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

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

When the program runs, the statements are executed in order. The order of the statements should make sense (of course!)

Now modify the program so the user enters the percentage for the tip. This time, there are no blanks to fill. Your job is to figure out how to change the program by inserting the following statements (not given in order.)

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

A nice way to do this is to copy the program into your editor and actually change the program. You should be able to copy and paste the above lines into the editor. Now compile and run it to see your results. There is one additional modification you will have to make to one of the original statements.

QUESTION 7:

Find the blanks. Then fill them in. Make the modification necessary to one of the original statements.