Part 2:   Now follow the instructions to create a class named PizzaPalaceFinal Open Eclipse. Select the project Chap7-PizzaPalaceFinal in the left pane. Next, create a New -> Class.  Name it PizzaPalaceFinal  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 "PizzaPalaceFinal.java" Add a comment at the top // (your name) Add another comment at the top // Exercise 7 Copy the code from your PizzaPalace.java file from Project 6  and paste it into this file.  Save the file. (Attached to this question is the code for PizzaPalace.java)   Edit your code for this file to implement an array of pizzas.  This change will only require modifications to your file "PizzaPalaceFinal.java": Requirements: Create an array of Pizza objects named pizzas and size it to the number of Pizzas specified by the user After you created each pizza object and verified it was correct, add code to store the pizza object in the array pizzas Add another for-loop to spin through the objects in the array pizzas: calculate the price of each pizza in the array add the price to the order total   Test your code to verify that it works.  Sample Output: 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: 3   Pizza #1 What size pizza? (1=small, 2=medium, 3=large): 1 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): 0 Please verify your order: Small ThinCrust Toppings= $12.00 Is this correct? (y=yes or n=no): y   Pizza #2 What size pizza? (1=small, 2=medium, 3=large): 2 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 : m Please verify your order: Medium ThickCrust Toppings=Pepperoni+Mushroom $19.00 Is this correct? (y=yes or n=no): y   Pizza #3 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 : g topping #2 : o topping #3 : s Please verify your order: Large StuffedCrust Toppings=GreenPepper+Onion+Sausage $24.00 Is this correct? (y=yes or n=no): y   Jason Tatum , your order has been placed. Your total with tax is: $58.44   Is this for Dine-In or Take-Out? (d=DineIn t=TakeOut): d We have free WIFI available while you dine in at our restaurant. When you arrive, please see the cashier to pay for your order and pickup your pizza. We look forward to your arrival!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Part 2:
 
Now follow the instructions to create a class named PizzaPalaceFinal
      1. Open Eclipse.
      2. Select the project Chap7-PizzaPalaceFinal in the left pane.
      3. Next, create a New -> Class.  Name it PizzaPalaceFinal  and check the first checkbox under "Which method stubs would you like to create?" and click Finish.
      4. Delete the green comment text in the file "PizzaPalaceFinal.java"
      5. Add a comment at the top // (your name)
      6. Add another comment at the top // Exercise 7
      7. Copy the code from your PizzaPalace.java file from Project 6  and paste it into this file.  Save the file. (Attached to this question is the code for PizzaPalace.java)
         
      8. Edit your code for this file to implement an array of pizzas.  This change will only require modifications to your file "PizzaPalaceFinal.java":
      9. Requirements:
        1. Create an array of Pizza objects named pizzas and size it to the number of Pizzas specified by the user
        2. After you created each pizza object and verified it was correct, add code to store the pizza object in the array pizzas
        3. Add another for-loop to spin through the objects in the array pizzas:
          • calculate the price of each pizza in the array
          • add the price to the order total
 
Test your code to verify that it works. 
Sample Output:
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: 3
 
Pizza #1
What size pizza? (1=small, 2=medium, 3=large): 1
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): 0
Please verify your order: Small ThinCrust Toppings= $12.00
Is this correct? (y=yes or n=no): y
 
Pizza #2
What size pizza? (1=small, 2=medium, 3=large): 2
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 : m
Please verify your order: Medium ThickCrust Toppings=Pepperoni+Mushroom $19.00
Is this correct? (y=yes or n=no): y
 
Pizza #3
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 : g
topping #2 : o
topping #3 : s
Please verify your order: Large StuffedCrust Toppings=GreenPepper+Onion+Sausage $24.00
Is this correct? (y=yes or n=no): y
 
Jason Tatum , your order has been placed.
Your total with tax is: $58.44
 
Is this for Dine-In or Take-Out? (d=DineIn t=TakeOut): d
We have free WIFI available while you dine in at our restaurant.
When you arrive, please see the cashier to pay for your order and pickup your pizza.
We look forward to your arrival!
import java.util.Scanner;
public class PizzaPalace {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.println("Welcome to Pizza Palace!! Let's take your order!!");
System.out.print("Enter your first and last name separated by a space: ");
String name = input.nextLine();
System.out.print("How many pizzas would you like to order: ");
int numPizzas = input.nextInt ();
input.nextLine();
for (int i = 1; i <= numPizzas; i++) {
System.out.printf("Pizza #%d\n", i);
System.out.print ("What size pizza? (1=small, 2-medium, 3-large): ");
int sizeNum=input.nextInt ();
String size = "";
switch (sizeNum) {
}
case 1:
size = "Small";
break;
case 2:
}
size="Medium";
break;
case 3:
size = "Large";
break;
default:
System.out.println("Invalid size. Please choose 1, 2, or 3.");
i--;
continue;
input.nextLine();
System.out.print ("What type crust? (1=ThinCrust, 2=ThickCrust, 3-StuffedCrust): ");
int crustNum = input.nextInt ();
String crust = "";
switch (crustNum) {
case 1:
crust = "ThinCrust";
break;
case 2:
crust = "ThickCrust";
break;
case 3:
crust = "StuffedCrust";
break;
default:
System.out.println("Invalid crust type. Please choose 1, 2, or 3.");
i--;
continue;
input.nextLine();
System.out.println("Here are our toppings: p=Pepperoni m-Mushroom g-Green Pepper o=Onion s-Sausage");
System.out.print ("How many toppings would you like? (0-5): ");
int numToppings = input.nextInt ();
input.nextLine();
String toppings = "";
for (int j = 1; j <= numToppings; j++) {
System.out.printf("Topping #%d: ", j);
String topping = input.nextLine();
switch (topping) {
case "p":
toppings += "Pepperoni";
break;
Transcribed Image Text:import java.util.Scanner; public class PizzaPalace { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.println("Welcome to Pizza Palace!! Let's take your order!!"); System.out.print("Enter your first and last name separated by a space: "); String name = input.nextLine(); System.out.print("How many pizzas would you like to order: "); int numPizzas = input.nextInt (); input.nextLine(); for (int i = 1; i <= numPizzas; i++) { System.out.printf("Pizza #%d\n", i); System.out.print ("What size pizza? (1=small, 2-medium, 3-large): "); int sizeNum=input.nextInt (); String size = ""; switch (sizeNum) { } case 1: size = "Small"; break; case 2: } size="Medium"; break; case 3: size = "Large"; break; default: System.out.println("Invalid size. Please choose 1, 2, or 3."); i--; continue; input.nextLine(); System.out.print ("What type crust? (1=ThinCrust, 2=ThickCrust, 3-StuffedCrust): "); int crustNum = input.nextInt (); String crust = ""; switch (crustNum) { case 1: crust = "ThinCrust"; break; case 2: crust = "ThickCrust"; break; case 3: crust = "StuffedCrust"; break; default: System.out.println("Invalid crust type. Please choose 1, 2, or 3."); i--; continue; input.nextLine(); System.out.println("Here are our toppings: p=Pepperoni m-Mushroom g-Green Pepper o=Onion s-Sausage"); System.out.print ("How many toppings would you like? (0-5): "); int numToppings = input.nextInt (); input.nextLine(); String toppings = ""; for (int j = 1; j <= numToppings; j++) { System.out.printf("Topping #%d: ", j); String topping = input.nextLine(); switch (topping) { case "p": toppings += "Pepperoni"; break;
}
}
case "s":
default:
case 1:
case "g":
case 2:
toppings += "Mushroom";
break;
case "o":
toppings += "Onion";
break;
case 3:
toppings += "Green Pepper";
break;
}
if (numToppings) {
toppings += ", ";
toppings += "Sausage";
break;
double cost = 0;
switch (sizeNum) {
System.out.println("Invalid topping. Please choose p, m, g, o, or s.");
cost + 7.99;
break;
case 2:
j--;
break;
cost +9.99;
break;
case 3:
cost +12.99;
break;
}
switch (crustNum) {
case 1:
cost += 0.99;
break;
cost + 1.99;
break;
cost +2.99;
break;
}
cost + numToppings* 0.5;
System.out.printf ("The cost of Pizza #%d is $%.2f\n", i, cost);
break;
if (i < numPizzas) {
System.out.print ("Would you like to order another pizza? (y/n): ");
String answer input.nextLine();
if (!answer.equals Ignore Case ("y")) {
System.out.printf("Thank you, %s, for your order!\n", name);
System.out.printf("You ordered %d pizza (s).\n", numPizzas);
Transcribed Image Text:} } case "s": default: case 1: case "g": case 2: toppings += "Mushroom"; break; case "o": toppings += "Onion"; break; case 3: toppings += "Green Pepper"; break; } if (numToppings) { toppings += ", "; toppings += "Sausage"; break; double cost = 0; switch (sizeNum) { System.out.println("Invalid topping. Please choose p, m, g, o, or s."); cost + 7.99; break; case 2: j--; break; cost +9.99; break; case 3: cost +12.99; break; } switch (crustNum) { case 1: cost += 0.99; break; cost + 1.99; break; cost +2.99; break; } cost + numToppings* 0.5; System.out.printf ("The cost of Pizza #%d is $%.2f\n", i, cost); break; if (i < numPizzas) { System.out.print ("Would you like to order another pizza? (y/n): "); String answer input.nextLine(); if (!answer.equals Ignore Case ("y")) { System.out.printf("Thank you, %s, for your order!\n", name); System.out.printf("You ordered %d pizza (s).\n", numPizzas);
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education