Question
QUESTION 1 Develop a class Animal that contains the following attributes: * Species of type string * Language of type string * Age of type
QUESTION 1
Develop a class Animal that contains the following attributes:
* Species of type string * Language of type string * Age of type integer
And the following methods:
* setSpecies(species) that allows user to set the objects species to the userspecified value. * setLanguage(language) that allows user to set the objects language to the userspecified value. * setAge(age) that allows user to set the objects age to the user-specified value. * An overloaded operator so that user can see the objects species, language, and age by typing its name
Sample output
>>> simba = Animal() >>> simba.setSpecies('lion') >>> simba.setLanguage('roar') >>> simba.setAge(5) >>> simba I am a lion, I roar, and I am 5 years old.
QUESTION 2
Write a program studentDatabase(numStudents) that allows user to specify the number of students with numStudents to input ID numbers and names and stores the information using the dictionary data structure. Then, it allows the user to look up a student by their ID number. The program should gracefully exit when the user enters a blank.
Sample Output: >>> studentDatabase(3) >>> Enter id of a new student: 1000 >>> Enter name of the new student: John Garcia
>>> Enter id of a new student: 2000 >>> Enter name of the new student: Lily Lane
>>> Enter id of a new student: 3000 >>> Enter name of the new student: Maria Lee
>>> Enter id to look up: 1000 John Garcia
>>> Enter id to look up: 2000 Lily Lane
>>> Enter id to look up: Have a good day!
>>> |
P.S - Hurry up and answer these two questions, I can be very impatient. ( must be typed )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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