Java Project named Bakery that includes two classes: Pie and PieTester. Your class must include an overloaded constructor that takes all three attributes as arguments, setters, and getters and the two methods shown in the UML diagram. The PieTester class will include a header with your name: “From the kitchen of A. Ramirez,” generate 3 pies using the default constructor and using the setter you will provide their attributes. Then, it will generate additionally 3 pies using the overloaded constructor. Using the showYourself() method it will display the 6 pies. Then, it will use the increasePrice() method to increase all six pies prices by 10% plus the last digit of your student number, i.e., if your last digit is 4, then it will increase it by 14%. Finally, use the showYourself() method again to display the 6 pies with their new prices.

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
Java Project named Bakery that includes two classes: Pie and
PieTester.
Your class must include an overloaded constructor that takes all three attributes as arguments,
setters, and getters and the two methods shown in the UML diagram.
The PieTester class will include a header with your name: “From the kitchen of A. Ramirez,”
generate 3 pies using the default constructor and using the setter you will provide their attributes.
Then, it will generate additionally 3 pies using the overloaded constructor. Using the
showYourself() method it will display the 6 pies. Then, it will use the increasePrice() method to
increase all six pies prices by 10% plus the last digit of your student number, i.e., if your last digit
is 4, then it will increase it by 14%. Finally, use the showYourself() method again to display the 6
pies with their new prices.
 
 
 
Pie
-UPC:String
-name:String
-price:double
+showYourself:void
+increasePrice(double percentage):void
Transcribed Image Text:Pie -UPC:String -name:String -price:double +showYourself:void +increasePrice(double percentage):void
Expert Solution
Step 1: Algorithm :

Algorithm for Bakery Project

1. Create a class named Pie with the following attributes:
   - UPC (String)
   - Name (String)
   - Price (double)

2. Define a default constructor for the Pie class:
   - Initialize UPC, Name, and Price to default values (empty string and 0.0).

3. Define an overloaded constructor for the Pie class that takes UPC, Name, and Price as arguments.
   - Initialize the attributes with the provided values.

4. Implement getters and setters for the UPC, Name, and Price attributes.

5. Define a method in the Pie class named showYourself:
   - Display the UPC, Name, and Price of the pie.

6. Define a method in the Pie class named increasePrice that takes a percentage as an argument:
   - Calculate the price increase by applying the percentage.
   - Update the Price attribute with the new price.

7. Create a class named PieTester.

8. Inside the PieTester class:
   - Print "From the kitchen of A. Ramirez" as a header.

9. Create three Pie objects using the default constructor and three using the overloaded constructor:
   - Initialize the pie objects with different UPC, Name, and Price values.

10. Display the information of all six pies using the showYourself method.

11. Calculate the price increase percentage as 10% plus the last digit of your student number.

12. Apply the increasePrice method to all six pies, increasing their prices using the calculated percentage.

13. Display the updated information of all six pies using the showYourself method.

End of Algorithm.

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
ADT and Class
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