Question 5 (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. 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 Price (RM) 9.90 25.90 37.90

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
icon
Related questions
Question

java code, pls use more // comments 

Question 5
(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
Price (RM)
9.90
25.90
37.90
Transcribed Image Text:Question 5 (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 Price (RM) 9.90 25.90 37.90
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Distributed Database Concepts
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage