Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with constructor declaration. I have a class called flower which has the following parameters: //constructor that accepts 3 colors public flower (Color

I need help with constructor declaration. I have a class called flower which has the following parameters:

//constructor that accepts 3 colors

public flower (Color tulip, Color rose, Color daisy)

{ this.tulip = tulip; this.rose = rose; this.daisy = daisy; }

If I want to make a class called garden, and want to make an instance of flower class: what constructor do I use to create a new object flower in the garden class?

Is this right? If not how do I do it?

flower = new flower(tulip, rose, daisy);

Note: I do not need output for this question.

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

Evaluate the sum. 243| 3 j=1

Answered: 1 week ago