Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

Students also viewed these Databases questions

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago