Question: a. Create a program named Eat.java that: 1. Instantiate Choc object named cadbury with arguments Orange and 14.2 which reference Confectionary class. 2. Instruct Choc

a. Create a program named Eat.java that:
1. Instantiate Choc object named cadbury with arguments Orange and 14.2 which reference Confectionary class.
2. Instruct Choc object in Q1(b)(i) to invoke print().
3. Instantiate Candy object named hudson which reference Confectionary class.
b. Modify class Choc to :
1. Create a constructor for Choc
2. Intialise the inherited data fields for calorie and flavor using value received from b(1).
MARKS: 40 ng questions and diagram is to guide you on writing a program which perform few calculation, and generat x9 Message Food You have consum $11.2 calories + calculate Calories (double reading): void OK + taste (String d Taste) : void Message Confectionary - calorie : double # flavor : String print) : void + taste (String dTaste) : void Raspberry candy taste nice! OK Message Choc Candy but Orange chocolate taste sweet like you You bring me so much joy print(): void OK Figure Qlia: Class Diagram
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
