-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pet Programming
79 lines (54 loc) · 2.14 KB
/
Pet Programming
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#Alex Zaugg, Kiki, Malcolm, Manu, Akim, Andrew
#CIS129 Fall 2022
#Personal Information OOP
#12-6-2022
class Pet:
def __init__(self, name,type,age):
self.pet_name = name
self.pet_type = type
self.pet_age = age
def getpetName(self):
return self.name
def getpetType(self):
return self.type
def getpetAge(self):
return self.age
class PersonalInformation:
def __init__(self,name,Animaltype,age):
self.__name = name
self.__Animaltype = Animaltype
self.__age = age
def getName(self):
return self.__name
def getAnimaltype(self):
return self.__Animaltype
def getAge(self):
return self.__age
def main():
petOne = getInfo()
petTwo = getInfo()
petThree = getInfo()
classForPetOne = PersonalInformation(petOne[0],petOne[1],petOne[2])
classForPetTwo = PersonalInformation(petTwo[0],petTwo[1],petTwo[2])
classForPetThree = PersonalInformation(petThree[0],petThree[1],petThree[2])
displayInfo("One",classForPetOne._PersonalInformation__name,classForPetOne._PersonalInformation__Animaltype, classForPetOne._PersonalInformation__age)
displayInfo("Two",classForPetTwo._PersonalInformation__name,classForPetTwo._PersonalInformation__Animaltype, classForPetTwo._PersonalInformation__age)
displayInfo("Three",classForPetThree._PersonalInformation__name,classForPetThree._PersonalInformation__Animaltype, classForPetThree._PersonalInformation__age)
print("------------------------------")
def getInfo():
arrayToReturn = []
nameToAppend = input("Enter Pet Name: ")
addressToAppend = input("What kind of Animal is " + nameToAppend + "? ")
ageToAppend = input("How Old Is " + nameToAppend + "? ")
arrayToReturn.append(nameToAppend)
arrayToReturn.append(addressToAppend)
arrayToReturn.append(ageToAppend)
return arrayToReturn
def displayInfo(value,name,Animaltype,age):
print("------------------------------")
print("Pet",value + "\'s name is:", name)
print("/n")
print( name + " is a:", Animaltype)
print("/n")
print(name + " is", age ,"years old")
main()