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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 7PE
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT