a. Create a class named Candle for a candle-making business. Include data fields for color, height, and

Question:

a. Create a class named Candle for a candle-making business. Include data fields for color, height, and price. Create get methods for all three fields. Create set methods for color and height, but not for price. Instead, when height is set, determine the price as $2 per inch. Save the file as Candle.java.

b. Create a child class named ScentedCandle that contains an additional data field named scent and methods to get and set it. In the child class, override the parent’s method that sets the height to set the price of a ScentedCandle object at $3 per inch. Save the file as ScentedCandle.java.

c. Write an application that instantiates a Candle object and ScentedCandle object. Prompt the user for values for each object. For the ScentedCandle, offer the user at least four choices for the scent, such as gardenia, but you do not need to verify that the user enters one of the four choices. Display the details for each Candle. Save the file as DemoCandles.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: