I have a problem with my program. When i try to compile it it says i need a ; can someone try to compile it and please help me?
//This program will represent a pizza
public class Pizza
{
private double cost; //the cost of the pizze
private String crust; //the type of crust
private int size; //the diameter in inches
private int numToppings; //the number of toppings
private String toppingList; //a list of the toppings
//Constructor creates a 12" Hand-Tossed pizza
public Pizza()
{
cost = 12.99;
crust = "Hand-Tossed";
size = 12;
numToppings = 0;
toppingList=null;
}
//adds the parameter amount to the cost
public void setCost (double amount)
{
cost +=amount;
}
//sets the crust type
public void setCrust (String type)
{
crust=type;
}
//changes the size of the pizza to the parameter diameter
public void setSize (int diameter)
{
size = diameter;
}
//sets the number of toppings to the parameter number
public void setNumToppings(int number)
{
numToppings=number;
}
//sets the list of toppings
public void setToppingsList (String newTopping)
{
toppingList = newTopping;
}
//returns the cost of the pizze
public double getCost()
{
return cost;
}
//returns the crust type
public String getCrust()
{
return crust;
}
//returns the size of the pizza
public int getSize()
{
return size;
}
//returns the number of toppings
public int getNumToppings()
{
return numToppings;
}
//returns the list of toppings
public String getToppingsList()
{
return toppingList;
}
}
//This program allows the user to order a pizza
import java.util.Scanner;
import java.text.*;
public class PizzaOrder
{
public static void main(String [] args)
{
//create a Scanner object to readinput
Scanner keyboard = new Scanner (System.in);
//creat an instance of a Pizza
Pizza order = new Pizza ();
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; //type of crust
double cost; //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's input
String toppings= "Cheese"; //list of toppings
int numberOfToppings = 0; //number of toppings
//prompt user and get first name
System.out.println("Welcome to Jack and Diane's Pizza");
System.out.print("Enter your first name:");
firstName = keyboard.nextLine();
//determine if user is eligible for discount by having the same first name as one of the owners
//TASK #1
if (discount)
{
firstName= "Jack";
}
else if (discount)
{
firstName= "Diane";
}
else
{
discount = false;
}
//prompt user and get pizza size choice
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.println("10, 12, 14, or 16 (enter the number only):");
inches = keyboard.nextInt();
//set price and size of pizza ordered
//ADD LINES HERE FOR TASK #2
Pizza PizzaInfo = new Pizza();
if (inches = 10)
{
call setSize();
call setCost();
cost -=2;
}
//consume the remaining newline character
keyboard.nextLine();
//prompt user and get crust choice
System.out.println("What type of crust would you like?");
System.out.println("(H)Hand-tossed, (T)Thin-crust, or " + "(D)Deep-dish (enter H, T, or D):");
input = keyboard.nextLine();
crustType = input.charAt(0);
//set user's crust choice on pizza ordered
//ADD LINES FOR TASK #3
//prompt user and get topping choices one at a time
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");
//if topping is desired, add to topping list and number of toppings
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";
}
//set number of toppings and topping list on pizza ordered
order.setNumToppings (numberOfToppings);
order.setToppingsList(toppings);
//add additional toppings cost to cost of pizza
order.setCost(1.25*numberOfToppings);
//display cost of pizza
cost = order.getCost();
//apply discount if user is eligible
//ADD LINES FOR TASK #4 HERE
//TASK #5
DecimalFormat form = new DecimalFormat("#.##"); //creates 2 decimal places
//SO ALL MONEY OUTPUT APPREARS WITH 2 DECIMAL PLACES
System.out.println("The cost of your order is:$" + form.format(cost));
//calc and display tax and total cost
tax = cost * TAX_RATE;
System.out.println("The tax is: $" + form.format(tax));
System.out.println("The total due is:$" + form.format((tax+cost)));
System.out.println("Your order will be ready" + " for pickup in 30 minutes.");
}
}