Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have been approached by a local zoo to help develop a software application that can be used to train their employees about the various
You have been approached by a local zoo to help develop a software application that can be used to train their employees about the various needs and costs associated with different animal species. The application should be text-based, and operate according to the following procedure:
- Ask the user to specify how many animals are present in the zoo.
- Ask the user to specify a unique name for each animal, as well as its species (Tiger, Elephant, Rhino, Panda or Monkey).
- Simulate a virtual week (starting from Monday and ending on Sunday) where each day the following occurs:
- Print the current weekday, and the status of each animal. Each animal's status is represented by three properties (Hunger, Thirst and Boredom). Each of these properties has an initial value of 50.
- Ask the user to select one of three items (Food, Water or Toy) for each animal in the zoo. This choice will update each animal's properties, as well as the week's total cost, according to the chart below. The same item cannot be given to an animal two days in a row. The value for any status property cannot drop below 0.
- If an animal's hunger, thirst or boredom value is greater than 100, then the animal will die. If this happens, an additional $1000 will be added to the total zoo cost. The program should not ask the user to specify an item for dead animals on any future days.
- After a full week has passed, the total cost of looking after all animals' during the week will be printed.
Animal | Food | Water | Toy |
---|---|---|---|
Tiger | -30 Hunger +15 Thirst +15 Boredom cost $30 | +15 Hunger -30 Thirst +15 Boredom cost $20 | +15 Hunger +15 Thirst -30 Boredom cost $40 |
Elephant | -50 Hunger +30 Thirst +20 Boredom cost $100 | +20 Hunger -50 Thirst +30 Boredom cost $40 | +30 Hunger +10 Thirst -40 Boredom cost $75 |
Rhino | -25 Hunger +5 Thirst +25 Boredom cost $50 | +5 Hunger -25 Thirst +25 Boredom cost $50 | +20 Hunger +20 Thirst -50 Boredom cost $20 |
Panda | -25 Hunger +15 Thirst +15 Boredom cost $60 | +40 Hunger -80 Thirst +10 Boredom cost $5 | +40 Hunger +15 Thirst -40 Boredom cost $10 |
Monkey | -30 Hunger +10 Thirst +10 Boredom cost $5 | +10 Hunger -40 Thirst +10 Boredom cost $5 | +10 Hunger +10 Thirst -15 Boredom cost $15 |
your program should also be able to handle the following situations:
- The user enters an invalid number of animals (either a non-integer value or a negative integer). If this happens you should tell the user that their input is invalid and then ask them again.
- The user enters a name for an animal that has already been given to a previous animal (i.e., a non-unique name). If this happens you should tell the user that this name has already been taken and then ask them again. Please be aware that name uniqueness should be case-sensitive, so "ANDY" and "andy" are two different names.
- The user enters an invalid animal or item name. If this happens you should tell the user that their input is invalid and then ask them again.
- The user enters an animal or item name that contains upper and/or lower case letters. For example, "TIGER", "Tiger" and "tiger" are all valid animal names and should be accepted by your program.
- The user enters the same item for a given animal two days in a row. If this happens you should tell the user that they cannot give the same item as yesterday and then ask them again.
Step by Step Solution
★★★★★
3.48 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
import random Define the animal data and costs animalsdata Tiger Food hunger 30 thirst 15 boredom 15 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started