Write Four java programs (Snack.java, FruitSnack.java, SaltySnack.java, and OrderSystem.java. A Word document that includes a test table with test case #, input, expected output, actual output, and pass/fail columns. There should be at least 3 test cases. Make sure to include test cases that validate data. Include a screen capture of running each test case. Include header comments that include your name, date, and description of the program. Include body comments. (1) There will be a Snack class with following attributes: id (combination of numbers and letters), size (values S, M, or L), and price (2) There will be two child classes FruitSnack and SaltySnack with the following additional attributes: o FruitSnack: It includes citrus fruit indication (value of this variable of is true or false) o SaltySnack: It includes nut snack indication (value of this variable of is true or false) (3) The Snack class hierarchy must provide the following functionality: • On creation, a snack instance must be given all attribute values except its price, which must be calculated. • Price is calculated as follows: o There is a flat fee of $19.99 for S snack, $29.99 for M snack, and $39.99 for L snack. o FruitSnack has an additional fee of $5.99 when it has a citrus fruit. Please add only a single citrus fruit, and no preventing coding is required to limit adding more than one. o SaltySnack has an additional fee of $4.50 when it has a nut snack. Please add only a single nut snack no preventing coding is required to limit adding more than one. • Each class must have a method to return or display the class’s values to the console. (4) Implement OrderSystem class with main method with following functionality: • Order a snack and after ordering it will display the snack type, its size, id and price. • Exit program. (5) Your classes must be coded with correct encapsulation: private/protected attributes, get methods, and set methods. (6) There should be appropriate overloading and overriding methods. (7) OrderSystem should take advantage of the inheritance properties (e.g., use Snack variable regardless which snack instance as appropriate). (8) The prices for S, M, L, citrus fruit, nut snack can be hard coded in the program.

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
Write Four java programs (Snack.java, FruitSnack.java, SaltySnack.java, and OrderSystem.java. A Word document that includes a test table with test case #, input, expected output, actual
output, and pass/fail columns. There should be at least 3 test cases. Make sure to include
test cases that validate data. Include a screen capture of running each test case. Include header comments that include your name, date, and description of the program. Include body comments.
(1) There will be a Snack class with following attributes: id (combination of numbers and letters), size
(values S, M, or L), and price
(2) There will be two child classes FruitSnack and SaltySnack with the following additional attributes:
o FruitSnack: It includes citrus fruit indication (value of this variable of is true or false)
o SaltySnack: It includes nut snack indication (value of this variable of is true or false)
(3) The Snack class hierarchy must provide the following functionality:
• On creation, a snack instance must be given all attribute values except its price, which must
be calculated.
• Price is calculated as follows:
o There is a flat fee of $19.99 for S snack, $29.99 for M snack, and $39.99 for L snack.
o FruitSnack has an additional fee of $5.99 when it has a citrus fruit. Please add
only a single citrus fruit, and no preventing coding is required to limit adding more
than one.
o SaltySnack has an additional fee of $4.50 when it has a nut snack. Please add
only a single nut snack no preventing coding is required to limit adding more than
one.
• Each class must have a method to return or display the class’s values to the console.
(4) Implement OrderSystem class with main method with following functionality:
• Order a snack and after ordering it will display the snack type, its size, id and price.
• Exit program.
(5) Your classes must be coded with correct encapsulation: private/protected attributes, get
methods, and set methods.
(6) There should be appropriate overloading and overriding methods.
(7) OrderSystem should take advantage of the inheritance properties (e.g., use Snack variable
regardless which snack instance as appropriate).
(8) The prices for S, M, L, citrus fruit, nut snack can be hard coded in the program.
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Top down approach design
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