(a) Write a class named Pizza based on the following members: ● ● ● A private instance variable name (String) that stores the name of a pizza A private instance variable description (String) that stores the description of a pizza A private instance variable size (char) that stores the size of a pizza. A private class variable discount (float) that stores the discount (in %) of all pizza A parameterized constructor that initialization the attributes name, description and size. A setter for attribute discount A method named price that returns the price of a pizza based on its size: Size 'P' 'R' 'L' Description Personal Regular Large Name Blazing Seafood Chicken Pepperoni Deluxe Cheese Price (RM) 9.90 (b) Based on the class designed in 5(a), write a statement for the following: i) To set the discount to 15%. ii) To create an array of Pizza with 3 elements. Assign the following data to each element: 25.90 37.90 Description Spicy sweet sour sauce, tuna, crabsticks, pineapples Tomato sauce, chicken pepperoni, mozzarella cheese Tomato sauce, mozzarella cheese Size L P
(a) Write a class named Pizza based on the following members: ● ● ● A private instance variable name (String) that stores the name of a pizza A private instance variable description (String) that stores the description of a pizza A private instance variable size (char) that stores the size of a pizza. A private class variable discount (float) that stores the discount (in %) of all pizza A parameterized constructor that initialization the attributes name, description and size. A setter for attribute discount A method named price that returns the price of a pizza based on its size: Size 'P' 'R' 'L' Description Personal Regular Large Name Blazing Seafood Chicken Pepperoni Deluxe Cheese Price (RM) 9.90 (b) Based on the class designed in 5(a), write a statement for the following: i) To set the discount to 15%. ii) To create an array of Pizza with 3 elements. Assign the following data to each element: 25.90 37.90 Description Spicy sweet sour sauce, tuna, crabsticks, pineapples Tomato sauce, chicken pepperoni, mozzarella cheese Tomato sauce, mozzarella cheese Size L P
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 13SA
Related questions
Question
java code, pls use more // comments
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage