Question: 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,

 1. Ereate a Duck class. The variables are String quack, String

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!