Question: import java.util.Scanner; import java.text.DecimalFormat; public class Pizzaproject { public static void main ( String [ ] args ) { DecimalFormat cash = new DecimalFormat (

import java.util.Scanner;
import java.text.DecimalFormat;
public class Pizzaproject {
public static void main(String[] args){
DecimalFormat cash = new DecimalFormat("0.00");
Scanner keyboard = new Scanner(System.in);
Pizza order = new Pizza();
String firstName;
boolean discount = false;
int inches;
char crustType;
double price;
final double TAX_RATE =0.07;
double tax;
char choice;
String input;
String toppings = "Cheese ";
int numberOfToppings =0;
if (inches ==8){
order.setSize(8);
order.setPrice(300);
} else if (inches ==10){
order.setSize(10);
order.setPrice(500);
} else if (inches ==12){
order.setSize(12);
order.setPrice(600);
} else if (inches ==14){
order.setSize(14);
order.setPrice(700);
} else {
System.out.println("Invalid size entered.");
}
keyboard.close();
System.out.println ("default 10 inch pizza is served if customer not select");
order.setSize (10);
order.setPrice (0);
}
keyboard.nextLine ();
System.out.println ("What type of crust do you need? ");
System.out.print ("(P) Pan, (C) crust-regular, or "+
"(G) crust-gluten-free (enter T, C, or G): ");
input = keyboard.nextLine();
switch (crustType)
{
case 'P':
case 'p':
order.setCrust ("Pan");
Break;
case 'C':
case 'c':
order.setCrust ("Crust-regular");
break;
case 'G':
case 'g':
order.setCrust ("crust-gluten-free ");
break;
default:
System.out.println (default pan pizza is served if customer not selects);
order.setCrust ("crust-gluten-free ");
}
System.out.println ("Every pizza comes with cheese.");
System.out.println ("Extra toppings are 20 each,"+select from");
System.out.println ("Sardines, Pepperoni, Diced Onion, Sliced Mushroom");
System.out.print ("Do you want Sardines? (Y/N): ");
input = keyboard.nextLine();
Select = input.charAt (0);
if (select =='Y'|| select =='y')
{
NumberOfToppings +=1;
toppings = toppings + "Sardines";
}
System.out.print ("Do you want Pepperoni? (Y/N): ");
Select = input.charAt(0);
if (select =='Y'|| select =='y')
{
numberOfToppings +=1;
toppings = toppings + "Pepperoni ";
}
System.out.print ("Do you want Diced Onion? (Y/N): ");
Select = input.charAt (0);
if (select =='Y'|| select =='y')
{
numberOfToppings +=1;
toppings = toppings + "Diced Onion ";
toppings = toppings + "Diced Onion ";
}
System.out.print ("Do you want Sliced Mushroom? (Y/N): ");
Select = input.charAt(0);
if (select =='Y'|| select =='y')
{
numberOfToppings +=1;
toppings = toppings + "Sliced Mushroom ";
}
order.setNumToppings (numberOfToppings);
order.setToppingList (toppings);
order.setPrice(20*numberOfToppings);
System.out.println ();
System.out.println ("Your order is ready: ");
System.out.println (order.getSize()+" inch pizza");
System.out.println (order.getCrust()+" crust");
System.out.println (order.getToppingList());
if (discount==true)
{
System.out.print ("User is eligible for 20% discount. ");
order.setPrice (-1);
}
Price = order.getPrice ();
System.out.println ("The price of your order is: "+ cash. Format (price));
Tax = price * TAX_AMOUNT;
System.out.println ("The tax is: "+ cash.format (tax));
System.out.println ("The total due is: "+ cash. Format (tax + price));
System.out.println ("Pizza is to be cooked" +" For pickup in 30 minutes.");
}
}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!