Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Your code will read the names of several animals ( maximum 2 0 ) from a given file named animals.txt 2 . Upon

1. Your code will read the names of several animals (maximum 20) from a given file named
animals.txt
2. Upon successfully reading the file, your code will generate another file to be written to disk. For each animal listed in animals.txt you will generate a number of such animals as residents of the simulated zoo. You will name the file, residents.txt.
3. There must be one or more residents of the same animal type. For example, if you read Tiger from animals.txt, you must create multiple instances of Tiger and identify each one by a 5-letter nickname generated randomly. The first letter of the nickname must be capitalised and the second letter cannot be the same as the first letter. Limit the number of instances of an animal to no more than 4 because you need to be mindful of the cost of feeding them. The number of instances must be generated randomly.
4. For each identifiable resident animal, you must assign an age chosen randomly between 1 and 20(inclusive) years.
5. For each identifiable resident animal, you must assign an initial weight chosen randomly between 2.5 kg and 30.5 kg (inclusive).
6. For each identifiable resident animal, you must assign a gender chosen randomly as either female or male.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions