-
Notifications
You must be signed in to change notification settings - Fork 0
/
adda_pets.rb
91 lines (67 loc) · 1.61 KB
/
adda_pets.rb
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
80
81
82
83
84
85
86
87
88
89
90
91
class Ferret #not capitalized
def set_name=(ferret_name) #remove spaces on either side of the =
@name = ferret_name
end
def get_name
return @name
end
def set_owner=(owner_name)
@owner_name = owner_name
end
def get_owner
return @owner_name
end
def squeal
return "squeeeeee"
end
end
class Chinchilla #chinkchilla was mispelled A LOT throughout the entire program! Consistency!
def set_name= (chinchilla_name)
@name = chinchilla_name
end
def get_name #had to add this section
return @name
end
def set_owner=(owner_name)
@owner_name = owner_name
end
def get_owner
return @owner_name
end
def squeek
return "eeeep"
end
end
class Parrot
def set_name=(parrot_name)
@name = parrot_name
end
def get_name
return @name
end
def set_owner=(owner_name)
@owner_name = owner_name
end
def get_owner
return @owner_name
end
def tweet #had to add this section
return "chirp chirp"
end
end
my_ferret = Ferret.new
my_ferret.set_name= "Fredo"
ferret_name = my_ferret.get_name
my_parrot = Parrot.new
my_parrot.set_name= "Budgie"
parrot_name = my_parrot.get_name #needed to make snake names
my_chinchilla = Chinchilla.new
my_chinchilla.set_name= "Dali"
chinchilla_name = my_chinchilla.get_name #needed to make snake names
puts "#{ferret_name} says #{my_ferret.squeal},
#{parrot_name} says #{my_parrot.tweet},
and #{chinchilla_name} says #{my_chinchilla.squeek}." #made sure snake names were all consistent throughout
#also had to change the .tweet to .squeak
puts my_ferret.inspect
puts my_parrot.inspect
puts my_chinchilla.inspect