Answered step by step
Verified Expert Solution
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)
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
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