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

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
Get step-by-step solutions from verified subject matter experts
