move-bear
that takes in a bear and a location and changes
the bear's location to the one given and changes the bear's weight if it
is not a polar bear.
;; move-bear: bear location -> bear ;; Comsumes a bear and changes the bear's location and weight if it is not a Polar bear
Everybody should be able to finish up to this point.
You want to study the effect that such a change in a bear's diet would have on the bear's weight.
(a) Write a function change-diet that consumes a bear and replaces all instances of fish in its diet with "farmed fish". This change only applies to bears in the California wildlife reserve.
(b) From observing bears in the wildlife reserve, you've noticed that since you made the switch to farmed salmon, bears who normally eat fish do not eat much of the salmon anymore. Instead, they rely mostly on other food sources from their diets. The wildlife reserve has many different types of berries, so bears who eat berries switch to relying mostly on this food source. The bears who previously relied on fish for food and now eat farmed salmon tend to lose 75 pounds due to this change. However, bears who did not eat fish in the first place benefit from the new surroundings and gain an average of 50 pounds. Write a function change-weight that takes in a bear and increases or decreases its weight appropriately. If the bear's weight is not affected, it should stay the same.
(c) Write several test cases for your function above that illustrate the effects of moving bears to the California wildlife reserve where they can only eat farmed salmon.
lab2-ecology.rkt
.