Question: Write a class called BugCollection whose main method creates both a Grasshopper and Bumblebee objects, calls the respireLungs and reproduceEggs methods of each object, calls

Write a class called BugCollection whose main method creates both a Grasshopper and Bumblebee objects, calls the respireLungs and reproduceEggs methods of each object, calls the jump method of the grasshopper and the protectHive method of the bumblebee.
I'm having trouble with the concept of inheritance and any help would be appreciated!
 Write a class called BugCollection whose main method creates both a
Grasshopper and Bumblebee objects, calls the respireLungs and reproduceEggs methods of each
object, calls the jump method of the grasshopper and the protectHive method

Implement the class hierarchy in the preceding UML given the following classes: class BodySection private String name; public BodySection(String s)[name =s:] public String toString() { return name;) class LongHindLegs (public String toString return "Long Hind Legs":)] class Stinger (public String toString [return "Stinger":}] Write a class called Bug Collection whose main method creates both a Grasshopper and Bumblebee objects, calls the respireLungs and reproduceEggs methods of each object, calls the jump method of the grasshopper and the protect Hive method of the bumblebee. Sample Run: ability to jump. A grasshopper is to a moneybee because ulars a Slinger and the ab FERRARI Insect -head: BodySection - thorax : BodySection - abdomen : BodySection + respireLungs(): void + reproduceEggs(): vold Grasshopper - longHindLegs: LongHindLegs + jump() : void Bumblebee - stinger: Stinger + protectHive(): void Figure 1 - UML for Insect and Subclasses protectHive method of the bumblebee. Sample Run: Demonstrate Grasshopper class using object hopper. An insect respires through lungs in its thorax. An insect reproduces by laying eggs from its abdomen. A grasshopper uses its Long Hind Legs to jump. Demonstrate Bumblebee class using object bumble. An insect respires through lungs.in its thorax An insect reproduces by laying eggs from its abdomen. A bumblebee uses its Stinger to protect the hive

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!