Question: Pizza Shop Code: (JAVASCRIPT) Pizzeria Class: Creates Pizza objects Introduce the pizzeria to the user, as shown in the sample output Validate the number of

Pizza Shop Code: (JAVASCRIPT)

Pizzeria Class: Creates Pizza objects

Introduce the pizzeria to the user, as shown in the sample output

Validate the number of pizzas that the user can order. They can only order between 1 and 5 pizzas.

For each pizza, you will:

Ask for the name of the pizza

You will ask for and validate the size of the pizza (pizzas can only be between 8 and 48 inches)

Calculate the cost of the pizza by multiplying the area of the pizza (obtained using Javas Math functions and constants) by some constant values for the cost of cheese, sauce, and dough and add it to a running total

Prompt the user for if they want pepperonis and validate the input. If they do add that onto the total cost.

Prompt the user to see if they would like to display the running total so far. Validate this input.

Finally, the program will print out how many pizzas the user ordered and the total.

For example, if the users name was John and he ordered one pizza worth 23.99, the output would be:

"Ok, John your total for your 1 pizza will come out to $23.99."

If we had a user named Andrew who ordered 3 pizzas, with the total cost being 68.43, the output would be:

Ok, Andrew your total for your 3 pizzas will come out to $68.43."

Constants:

cheese cost per square inch: 0.0068;

sauce cost per square inch: 0.0079;

dough cost per square inch: 0.0057;

pepperoni cost per square inch: 0.0071;

-------------------------------------------------

Sample interaction:

Welcome to Bob's Pizzeria!

Can I have your name please?

Bob

Ok, let's start your order, Bob.

How many pizzas would you like to order?

Our oven can only accommodate 5 pizzas per customer.

3

What would you like to name pizza number 1?

Pep

What size would you like Pep to be?

We can handle pizzas between 8 and 48 inches.

6

Please order a pizza between 8 and 48 inches

50

Please order a pizza between 8 and 48 inches

40

Would you like pepperonis on this pizza?

Please type Y for Yes or N for No.

Q

Invalid input. Please type Y for Yes or N for No.

Y

Would you like to display the total so far? (Y/N)

Q

Invalid input. Please type Y to display the total and N to continue.

Y

Total: $138.23

What would you like to name pizza number 2?

PersonalPan

What size would you like PersonalPan to be?

We can handle pizzas between 8 and 48 inches.

12

Would you like pepperonis on this pizza?

Please type Y for Yes or N for No.

N

Would you like to display the total so far? (Y/N)

N

What would you like to name pizza number 3?

Personal

What size would you like Personal to be?

We can handle pizzas between 8 and 48 inches.

12

Would you like pepperonis on this pizza?

Please type Y for Yes or N for No.

N

Would you like to display the total so far? (Y/N)

N

Ok, Bob your total for your 3 pizzas will come out to $156.69.

-----------------------------------------------

Sample Code: (Organization)

public class Pizzeria {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

// input code

scnr.close();

}

}

---------------------------------------------------------------

Code in JavaScript Only use Java Scanner Import No Specific Functions

-------------------------------------------------------------------------------------------------------

Thanks in advance for any help!

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 Databases Questions!