Open Eclipse. Create a New  -> Java project.  Name it Chap7-PizzaPalaceFinal  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 // Exercise 7 Copy the code from your Pizza.java file from Exercise 6  and paste it into this file.  Save the file.  The UML has been provided with this project for reference. (ATTACHED IS A PHOTO OF THE UML)

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
Exercise 7 Part I: 
Follow the instructions to create a class named Pizza:
      1. Open Eclipse.
      2. Create a New  -> Java project.  Name it Chap7-PizzaPalaceFinal  and click Finish and OK.
      3. 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.
      4. Delete the green comment text in the file "Pizza.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 Pizza.java file from Exercise 6  and paste it into this file.  Save the file.  The UML has been provided with this project for reference. (ATTACHED IS A PHOTO OF THE UML)

*Hint:  Code this so that it complies with the Pizza class UML provided.

Below is the Pizza.java file that you need to paste:

public class Pizza{

private String size;

private String crust;

private String toppings;

 

public Pizza(String size, String crust, String toppings) {

this.size = size;

this.crust = crust;

this.toppings = toppings;

}

 

public Pizza() {

this.size = "tbd";

this.crust = "tbd";

this.toppings = "tbd";

}

 

public String getSize() {

returnsize;

}

 

publicvoid setSize(String size) {

this.size = size;

}

 

public String getCrust() {

returncrust;

}

 

publicvoid setCrust(String crust) {

this.crust = crust;

}

 

public String getToppings() {

returntoppings;

}

 

publicvoid setToppings(String toppings) {

this.toppings = toppings;

}

 

publicdouble calcPrice() {

doubleprice = 0.0;

if (size.equals("1")) {

price += 12.00;

} else if (size.equals("2")) {

price += 15.00;

} else if (size.equals("3")) {

price += 18.00;

}

price += (toppings.split("\\+").length) * 2.00;

returnprice;

}

 

publicboolean equals(Pizza other) {

returnsize.equals(other.getSize()) &&

crust.equals(other.getCrust()) &&

toppings.equals(other.getToppings());

}

 

public String toString() {

returnsize + " " + crust + " Toppings=" + toppings.replace("+", " ");

}

}

  

- size: String
- crust: String
- toppings: String
UML Diagram for the Pizza Class
Pizza
// "Small", "Medium", or "Large"
// "Thick", "Thin", or "Stuffed"
// ex: "Pepperoni+Mushroom+GreenPepper"
+ Pizza(s: String, c: String, t: String)
+ Pizza ()
+ setSize(s: String) : void
+ setCrust(c: String): void
+ setToppings(t : String): void
+ getSize(): String
+ getCrust(): String
+ getToppings(): String
+ calcPrice(): double //use: small=$12.00, medium=$15.00, large=$18.00 add $2.00 per topping
+ equals(p2 : Pizza) : boolean
+ toString(): String
// use: "tbd", "tbd", "tbd"
Transcribed Image Text:- size: String - crust: String - toppings: String UML Diagram for the Pizza Class Pizza // "Small", "Medium", or "Large" // "Thick", "Thin", or "Stuffed" // ex: "Pepperoni+Mushroom+GreenPepper" + Pizza(s: String, c: String, t: String) + Pizza () + setSize(s: String) : void + setCrust(c: String): void + setToppings(t : String): void + getSize(): String + getCrust(): String + getToppings(): String + calcPrice(): double //use: small=$12.00, medium=$15.00, large=$18.00 add $2.00 per topping + equals(p2 : Pizza) : boolean + toString(): String // use: "tbd", "tbd", "tbd"
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 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
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