-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbikes2.rb
58 lines (46 loc) · 1006 Bytes
/
bikes2.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
class Vehicle
def set_name=(model_name)
@name=model_name
end
def get_name
return @name
end
def set_company=(company_name)
@company=company_name
end
def get_company
return @company
end
def set_type=(frame_type)
@type=frame_type
end
def get_type
return @type
end
end
class Bike < Vehicle
def yawp
return "wheeeeeee"
end
end
class Car < Vehicle
def grump
return "arrrrgh"
end
def get_top_speed
return @speed
end
end
my_bike = Bike.new
my_bike.set_name='Betty Foy'
my_bike.set_company='Rivendell'
bikename = my_bike.get_name
bikecomp = my_bike.get_company
my_car = Car.new
my_car.set_name ="Focus"
my_car.set_company = "Ford"
carname = my_car.get_name
carcomp = my_car.get_company
puts "When I drive my #{carcomp} #{carname}, I say #{my_car.grump}. When I ride my #{bikecomp} #{bikename}, I say #{my_bike.yawp}."
puts my_car.inspect
puts my_bike.inspect