Really late, but here it is:
import java.util.Scanner;
import java.text.DecimalFormat;
public class Pisa
{
public static void main (String [] args)
{
double amount = 00.00;
DecimalFormat money = new DecimalFormat("00.00");
System.out.print(money.format(amount));
Scanner keyboard = new Scanner (System.in);
String firstName; //user's first name
boolean discount = false; //flag, true if user is eligible for discount
int inches; //size of the pizza
char crustType; //code for type of crust
String crust = null; //name of crust
double cost = 12.99; //cost of the pizza
final double TAX_RATE = .08; //sales tax rate
double tax; //amount of tax
char choice; //user's choice
String input; //user input
String toppings = "Cheese "; //list of toppings
int numberOfToppings = 0; //number of toppings
System.out.println("Welcome to Mike and Diane's Pizza");
System.out.print("Enter your first name: ");
firstName = keyboard.nextLine();
//convert name input from user to lower case, so method only
// has to check for "mike" or "diane", in which case discount will become true
firstName = firstName.toLowerCase();
if (firstName.equals("mike")||(firstName.equals("diane")))
{
discount = true;
}
System.out.println("Pizza Size (inches) Cost");
System.out.println(" 10 $10.99");
System.out.println(" 12 $12.99");
System.out.println(" 14 $14.99");
System.out.println(" 16 $16.99");
System.out.println("What size pizza would you like?");
System.out.print("10, 12, 14, or 16 (enter the number only): ");
inches = keyboard.nextInt();
//check for size input and match it accordingly to the price
//if the input doesn't match one of the presented size, the size will be default to 12 inches
if ( inches == 10)
{
cost = cost - 2;
}
else if ( inches == 12)
{
cost = cost;
}
else if ( inches == 14)
{
cost = cost + 2;
}
else if ( inches == 16)
{
cost = cost + 4;
}
else
{
inches = 12;
cost = cost;
System.out.println("You didn't enter what was required. 12 inches coming up.");
}
keyboard.nextLine();
System.out.println("What type of crust do you want? ");
System.out.print("(H)Hand-tossed, (T) Thin-crust, or " +
"(D) Deep-dish (enter H, T, or D): ");
input = keyboard.nextLine();
crustType = input.charAt(0);
// If they enter one of the characters in the switch method below, they'll get the type they desired
// if they didn't enter anything or input doesn't match, it will default to Hand-tossed crust
switch (crustType) {
case 1: crustType = 'd';
break;
case 2: crustType = 'D';
break;
case 3: crustType = 'h';
break;
case 4: crustType = 'H';
break;
case 5: crustType = 't';
break;
case 6: crustType = 'T';
break;
}
if (crustType == 'd')
{
crust = "Deep-dish";
System.out.println(crust + " crust");
}
else if (crustType == 'D')
{
crust = "Deep-dish";
System.out.println(crust + " crust");
}
else if (crustType == 'T')
{
crust = "Thin crust";
System.out.println(crust );
}
else if (crustType == 't')
{
crust = "Thin crust";
System.out.println(crust );
}
else if (crustType == 'h')
{
crust = "Hand-tossed";
System.out.println(crust + " crust");
}
else if (crustType == 'H')
{
crust = "Hand-tossed";
System.out.println(crust + " crust");
}
else
{
System.out.println("You didn't enter a correct choice. Hand-tossed pizza coming up.");
crust = "Hand-tossed";
}
System.out.println("All pizzas come with cheese.");
System.out.println("Additional toppings are $1.25 each,"
+" choose from");
System.out.println("Pepperoni, Sausage, Onion, Mushroom");
System.out.print("Do you want Pepperoni? (Y/N): ");
input = keyboard.nextLine();
choice = input.charAt(0);
if (choice == 'Y' || choice == 'y')
{
numberOfToppings += 1;
toppings = toppings + "Pepperoni ";
}
System.out.print("Do you want Sausage? (Y/N): ");
input = keyboard.nextLine();
choice = input.charAt(0);
if (choice == 'Y' || choice == 'y')
{
numberOfToppings += 1;
toppings = toppings + "Sausage ";
}
System.out.print("Do you want Onion? (Y/N): ");
input = keyboard.nextLine();
choice = input.charAt(0);
if (choice == 'Y' || choice == 'y')
{
numberOfToppings += 1;
toppings = toppings + "Onion ";
}
System.out.print("Do you want Mushroom? (Y/N): ");
input = keyboard.nextLine();
choice = input.charAt(0);
if (choice == 'Y' || choice == 'y')
{
numberOfToppings += 1;
toppings = toppings + "Mushroom ";
}
cost = cost + (1.25*numberOfToppings);
if (discount) //if discount = true, they get 2$ off and displays a message
{
cost = cost - 2;
System.out.println("You're eligible for a 2$ discount");
}
System.out.println();
System.out.println("Your order is as follows: ");
System.out.println(inches + " inches pizza");
System.out.println(crust + "pizza");
System.out.println(toppings + "toppings");
System.out.println("The cost of your order is: $" + money.format(cost));
tax = cost * TAX_RATE;
System.out.println("The tax is: $" + money.format(tax)); //decimalFormat changed
System.out.println("The total due is: $" + money.format(tax+cost));// 16.9999 to 16.99
System.out.println("Your order will be ready for pickup in 30 minutes.");
}
}