Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Java) 1. Ereate a Duck class. The variables are String quack, String duckType, and double size. Create a regular constructor, no-args constructor, getters, setters, copy

(Java)
image text in transcribed
1. Ereate a Duck class. The variables are String quack, String duckType, and double size. Create a regular constructor, no-args constructor, getters, setters, copy method, equals method, and toString method. There should also be a greeting method that outputs the quack variable twice. 2. Create a Mallard class. The Mallard class is a subclass/childclass of Duck. The Mallard class has extra variables String sex (male or female) and String headColor (green or brown). There should also be a greeting method that outputs "honk honk!". Make sure to use the super keyword when creating the Mallard. 3. Create an array of Mallards in main. 4. Show that every Mallard uses the Mallard greeting method and not the Duck greeting method

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

More Books

Students also viewed these Databases questions

Question

=+33-1 Explain why we forget.

Answered: 1 week ago

Question

Additional Factors Affecting Group Communication?

Answered: 1 week ago