Hello,
i'm learning object -oriented programming,
I was told to create a program that once the class had been designed, to create an object of the class and prompt the user to enter the name, type, and age of his or her pet. The data should be stored in the object. The object acessor methods to retrieve the pet's name, type and age and display this data on the screen.
here is what i have, but i'm getting a error. any help will be much appreciate
class Pet:
def __init__(self,petName,petAge,myPet):
self.__myPet= newPet
def setName(self,n):
self.__setName=n
def setType (self, t):
self.__setType=t
def setAge(self, a):
self.__setAge= a
def getName (self):
return self.__Name
def getType (self):
return self.__Type
def getAge (self):
return self.__Age
def main():
myPet.setName(petName)
petName= input= ('Please enter your pets name')
myPet.setType(petType)
petType= input= ('Please enter your pets type.ie:Dog,Cat,Bird,Reptile')
myPet.setAge(petAge)
petAge= raw_input= ('Please enter your pets age')
print myPet.getName()
print myPet.getType()
print myPet.getAge()
main()