1. Draw an object hierarchy diagram for various kinds of people. 2. Declare a new class called Plant, extended from Organism with one extra method: Suppose fern is a plant. Activating...


1. Draw an object hierarchy diagram for various kinds of people.


2. Declare a new class called Plant, extended from Organism with one extra method:





Suppose fern is a plant. Activating fern.NibbledOn(m) corresponds to some beast eating m ounces of fern. Notice that NibbledOn differs from the existing alterSize method, since in the NibbledOn method the amount is removed from the size (rather than adding to the size), and there is also a strict precondition on the amount eaten. The nibbledOn implementation should activate alterSize to do some of its work.


Your Plant class should have one constructor with the same parameters as the Organism constructor. The plant’s constructor merely activates the super constructor with these same parameters.


Nov 23, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here