#C3712. Zoo Management System
Zoo Management System
Zoo Management System
This problem requires you to implement a simple Zoo Management System. The system should maintain information about animals where each animal is identified by its unique name and has associated attributes: species, age, and gender. You will receive a series of commands to manipulate the Zoo database. The operations include adding a new animal, retrieving the details of an animal, updating the animal's information, removing an animal from the system, and listing all animals in lexicographical order. Note that the sorting can be mathematically described as \(\text{sorted}(names)\) where the names are ordered in ascending order.
inputFormat
The first line of input is an integer \(n\) representing the number of commands. Each of the following \(n\) lines contains one command. The commands follow one of these formats:
- ADD name species age gender - Adds a new animal. If an animal with the same name already exists, output
False
, otherwise outputTrue
. - GET name - Retrieves animal details in the order: species age gender. If the animal does not exist, output
None
. - UPDATE name species age gender - Updates the information of an existing animal. If a field should remain unchanged, a dash (
-
) is used in its place. OutputTrue
if the update is successful; otherwise, outputFalse
if the animal does not exist. - REMOVE name - Removes an animal identified by
name
. OutputsTrue
if removal is successful, otherwiseFalse
. - LIST - Prints all animal names sorted in lexicographical order separated by a space. If there are no animals, print an empty line.
outputFormat
For each command that produces an output (ADD, GET, UPDATE, REMOVE, LIST), print the result on a new line. The output should exactly match the expected values, including booleans and text.
## sample9
ADD Leo Lion 5 Male
ADD Mia Elephant 8 Female
ADD Leo Lion 6 Male
GET Leo
UPDATE Leo - 6 -
GET Leo
REMOVE Leo
GET Leo
LIST
True
True
False
Lion 5 Male
True
Lion 6 Male
True
None
Mia
</p>