**USING JAVA ON ECLIPSE** There are two parts to this practice exercise! (NOT GRADED) Just for you to continue working on your skills over this weekend. Part I: Now follow the instructions to create a new class named Pizza: Open Eclipse. Create a New -> Java project. Name it Chap6-PizzaPalace and click Finish and OK. Next, create a New -> Class. Name it Pizza and DO NOT check the first checkbox under "Which method stubs would you like to create?" and click Finish. Delete the green comment text in the file "Pizza.java" Add a comment at the top // (your name) Add another comment at the top // Practice 6 Study the UML provided with this practice problem. Code class Pizza according to the UML given, be sure to include all data fields, methods, and variables as specified. (USE THE UML DIAGRAM ATTACHED TO BASE/structure of your code off of for Part 1) Part 2: Now follow the instructions to create a new class named PizzaPalace Open Eclipse. Select the project Chap6-PizzaPalace in the left pane. Next, create a New -> Class. Name it PizzaPalace and check the first checkbox under "Which method stubs would you like to create?" and click Finish. Delete the green comment text in the file "PizzaPalace.java" Add a comment at the top // (your name) Add another comment at the top // Practice 6 Study the output given below to create a program to produce the output given below. Requirements: Use a for-loop to process each pizza order Use a for-loop to process each topping Use your full-arg constructor to create each Pizza object with the input data Call your toString() method to print each pizza's data Format monetary values to 2 decimal places with printf *Hint: Program one part at a time and test each part as you go along. Don't worry about error checking the user input until you have a working program. Test your code to verify that it works. Sample Outputs: Welcome to Pizza Palace!! Let's take your order!! Enter your first and last name seperated by a space: Jason Tatum How many pizzas would you like to order: 2 Pizza #1 What size pizza? (1=small, 2=medium, 3=large): 1 What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 2 Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage How many toppings would you like? (0-5): 2 topping #1 : p topping #2 : s Please verify your order: Small ThickCrust Toppings=Pepperoni+Sausage Is this correct? (y=yes or n=no): y The price of your pizza is: $16.00 Pizza #2 What size pizza? (1=small, 2=medium, 3=large): 3 What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 3 Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage How many toppings would you like? (0-5): 3 topping #1 : m topping #2 : g topping #3 : o Please verify your order: Large StuffedCrust Toppings=Mushroom+GreenPepper+Onion Is this correct? (y=yes or n=no): y The price of your pizza is: $24.00 Jason Tatum, your total with tax is: $42.50 Is this for Dine-In or Take-Out? (1=dineIn 2=takeout): 2 You can park in the designated order pickup spots in front. ____________________________________________________________________________________________________________________________ Welcome to Pizza Palace!! Let's take your order!! Enter your first and last name seperated by a space: David Pastrnak How many pizzas would you like to order: 1 Pizza #1 What size pizza? (1=small, 2=medium, 3=large): 5 oops, try again... What size pizza? (1=small, 2=medium, 3=large): 1 What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 4 oops, try again... What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 1 Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage How many toppings would you like? (0-5): 6 oops, try again... How many toppings would you like? (0-5): 1 topping #1 : s Please verify your order: Small ThinCrust Toppings=Sausage Is this correct? (y=yes or n=no): y The price of your pizza is: $14.00 David Pastrnak, your total with tax is: $14.88 Is this for Dine-In or Take-Out? (1=dineIn 2=takeout): 1 We have free WIFI available while you dine in at our restaurant.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
-
-
- Open Eclipse.
- Create a New -> Java project. Name it Chap6-PizzaPalace and click Finish and OK.
- Next, create a New -> Class. Name it Pizza and DO NOT check the first checkbox under "Which method stubs would you like to create?" and click Finish.
- Delete the green comment text in the file "Pizza.java"
- Add a comment at the top // (your name)
- Add another comment at the top // Practice 6
- Study the UML provided with this practice problem. Code class Pizza according to the UML given, be sure to include all data fields, methods, and variables as specified.
-
(USE THE UML DIAGRAM ATTACHED TO BASE/structure of your code off of for Part 1)
Now follow the instructions to create a new class named PizzaPalace
-
-
- Open Eclipse.
- Select the project Chap6-PizzaPalace in the left pane.
- Next, create a New -> Class. Name it PizzaPalace and check the first checkbox under "Which method stubs would you like to create?" and click Finish.
- Delete the green comment text in the file "PizzaPalace.java"
- Add a comment at the top // (your name)
- Add another comment at the top // Practice 6
- Study the output given below to create a
program to produce the output given below. - Requirements:
- Use a for-loop to process each pizza order
- Use a for-loop to process each topping
- Use your full-arg constructor to create each Pizza object with the input data
- Call your toString() method to print each pizza's data
- Format monetary values to 2 decimal places with printf
-
*Hint: Program one part at a time and test each part as you go along. Don't worry about error checking the user input until you have a working program.
Test your code to verify that it works.
Sample Outputs:
Welcome to Pizza Palace!! Let's take your order!!
Enter your first and last name seperated by a space: Jason Tatum
How many pizzas would you like to order: 2
Pizza #1
What size pizza? (1=small, 2=medium, 3=large): 1
What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 2
Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage
How many toppings would you like? (0-5): 2
topping #1 : p
topping #2 : s
Please verify your order: Small ThickCrust Toppings=Pepperoni+Sausage
Is this correct? (y=yes or n=no): y
The price of your pizza is: $16.00
Pizza #2
What size pizza? (1=small, 2=medium, 3=large): 3
What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 3
Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage
How many toppings would you like? (0-5): 3
topping #1 : m
topping #2 : g
topping #3 : o
Please verify your order: Large StuffedCrust Toppings=Mushroom+GreenPepper+Onion
Is this correct? (y=yes or n=no): y
The price of your pizza is: $24.00
Jason Tatum, your total with tax is: $42.50
Is this for Dine-In or Take-Out? (1=dineIn 2=takeout): 2
You can park in the designated order pickup spots in front.
____________________________________________________________________________________________________________________________
Welcome to Pizza Palace!! Let's take your order!!
Enter your first and last name seperated by a space: David Pastrnak
How many pizzas would you like to order: 1
Pizza #1
What size pizza? (1=small, 2=medium, 3=large): 5
oops, try again...
What size pizza? (1=small, 2=medium, 3=large): 1
What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 4
oops, try again...
What type crust? (1-ThinCrust, 2= ThickCrust, 3=StuffedCrust): 1
Here are our toppings: p=Pepperoni m=Mushroom g=GreenPepper o=Onion s=Sausage
How many toppings would you like? (0-5): 6
oops, try again...
How many toppings would you like? (0-5): 1
topping #1 : s
Please verify your order: Small ThinCrust Toppings=Sausage
Is this correct? (y=yes or n=no): y
The price of your pizza is: $14.00
David Pastrnak, your total with tax is: $14.88
Is this for Dine-In or Take-Out? (1=dineIn 2=takeout): 1
We have free WIFI available while you dine in at our restaurant.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images