Answered step by step
Verified Expert Solution
Link Copied!

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:

  1. Ask the user to specify how many animals are present in the zoo.
  2. Ask the user to specify a unique name for each animal, as well as its species (Tiger, Elephant, Rhino, Panda or Monkey).
  3. 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.
  4. After a full week has passed, the total cost of looking after all animals' during the week will be printed.
AnimalFoodWaterToy
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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management Accounting Information for Decision-Making and Strategy Execution

Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young

6th Edition

137024975, 978-0137024971

More Books

Students also viewed these Programming questions

Question

vx, and y = 45 when x =-15 What is the value of y when x = - 6

Answered: 1 week ago