Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 DiagramStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started