Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

99 99 100 110 121 00 90 81

Answered: 1 week ago