InfoTc’1040’Introduction’to’Problem’Solving’….

$25.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

InfoTc’1040’Introduction’to’Problem’Solving’and’Programming’Animal’Class ’In this programming assignment you are going to create a class named Animal thatis used to store information about an animal. You will then create a program thattakes user input, allowing the user to create multiple Animal objects. Finally, youwill retrieve the information stored in those objects and display it.Animal’ ClassWrite a class named Animal that has the following attributes and methods. Save thisclass asAnimal.pyAttributes’__animal_type: a hidden attribute used to indicate the animal’s type. Forexample: gecko, walrus, tiger, etc.__name: a hidden attribute used to indicate the animal’s name.__mood: a hidden attribute used to indicate the animal’s mood. Forexample: happy, hungry, or sleepy.Methods’__init__: this method should create the three attributes above and assigntheir default values.The value of__moodshould be set randomly. Generate a random numberbetween 1 and 3. Then:If the number is 1, the__moodfield should be set to a value of “happy”.If the number is 2, the__moodfield should be set to a value of “hungry”.If the number is 3, the__moodfield should be set to a value of “sleepy”.get_animal_type: this method should return the value of the__animal_typefield.get_name: this method should return the value of the__namefield.check_mood: this method should return the value of the__moodfield

Animal’Generator’ ProgramOnce you have written the Animal class, create another program calledanimalGenerator.py. This program should useAnimal.pyas a module.InanimalGenerator.py, prompt the user to enter the name and type of an animal.Create a new Animal object to store this data. Then ask the user if they would like torepeat the process. They should be able to create as many Animal objects as theywould like.After the user is done creating animals, this program should use the object’saccessor methods to retrieve the name, type, and mood of each animal. Thisinformation should be formatted and displayed as shown in the sample programoutput below.Sample’Program’OperationUser input is highlighted inorange.Welcome to the animal generator!This program creates Animal objectsWhat type of animal would you like to create?GeckoWhat is the animal’s name?GordonWould you like to add more animals (y/n)?yWhat type of animal would you like to create?WalrusWhat is the animal’s name?WallyWould you like to add more animals (y/n)?yWhat type of animal would you like to create?TigerWhat is the animal’s name?TrumanWould you like to add more animals (y/n)?nAnimal List———–Gordon the Gecko is hungryWally the Walrus is sleepyTruman the Tiger is hungry