Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a. Create a class for Potato with data fields for type (such as red) and calories per serving. Include a constructor that takes parameters for

a. Create a class for Potato with data fields for type (such as red) and calories per serving. Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Also include a public final static String named SLOGAN and initialize it to Potatoes are good for You. Write an application named TestPotatoes to instantiate three Potato objects with different values, and then display all the data, including the Slogan, for each object. Save both the Potato.java and TestPotato.java files.

b. Create a class named CookedPotato which extends Potato. Include a field for the cooked type such as (mashed potato) and another field for additional calories in a serving. Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Write a programon named TestCookedPotato to instantiate three CookedPotato objects with different values, and then display all the data for each object. Save both the CookedPotato.java and TestCookedPotato.java files.

c. Create a class named Extra which extends CookedPotato. Include four fields for extras, such as (sour cream, bacon bits) and fields for calories. Include constructors that takes 2 through 5 parameters for each field needed, and include get methods that returns the values of the fields.

d. Create a class named Menu that contains type of potato, cooked type, any extras and the total calories for potato, cooked type and extras. The restaurant carries 3 types of potatoes and 4 types of cooking and 4 types of extras. (you decide types of potato, cooking and extras the restaurant carries). Instantiate at least four objects to include all three types of potatoes and all four types of cooking and whatever extras you choose.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions