Lab This lab has been inspired by my own struggles attempting to grow a vegetable garden this summer We want to create a

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Lab This lab has been inspired by my own struggles attempting to grow a vegetable garden this summer We want to create a

Post by answerhappygod »

Lab This Lab Has Been Inspired By My Own Struggles Attempting To Grow A Vegetable Garden This Summer We Want To Create A 1
Lab This Lab Has Been Inspired By My Own Struggles Attempting To Grow A Vegetable Garden This Summer We Want To Create A 1 (177.68 KiB) Viewed 28 times
Lab This lab has been inspired by my own struggles attempting to grow a vegetable garden this summer We want to create a series of objects as follows: A plant object which has the following attributes: O Has been Watered (default set to false) O Is Alive (default set to true) O Has Fruit (default set to false) A raccoon object which has the following methods: O Eats Plants A human object which has the following methods: O Waters Plants O Picks Fruit Please create code which simulates the following interactions: Raccoons can eat plants, which causes the plants to not have fruit and die Humans can water plants, which causes the plants to be watered and create fruit Humans can pick the fruit, which will cause the plant to not have fruit Please see the below example:
h = Human() Plant() р r = Raccoon () p = h.water (p) p = h.pick_fruit (p) print("Plant is watered? ", p.watered) || print("Plant has fruit? ', p. fruit) p = r.eat_plants (p) print("The raccoon just ate the plant") print("Plant is alive? " p.alive) I = Plant is watered? True Plant has fruit? False The raccoon just ate the plant Plant is alive? False
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply