Created
December 19, 2023 21:24
-
-
Save csyversen/573065a11e5aed887927fd2a2203c86f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarNavigation | |
def initialize(a, b) | |
@a = a | |
@b = b | |
end | |
def drive_to_chicago(lat, lng) | |
@a.start_car | |
@a.drive_to_lat_lng(lat, lng) | |
@a.park | |
end | |
def drive_to_new_york(lat, lng) | |
@a.start_car | |
@a.drive_to_lat_lng(lat, lng) | |
@a.park | |
end | |
def drive_to_la(lat, lng) | |
@a.start_car | |
@a.drive_to_lat_lng(lat, lng) | |
@a.park | |
end | |
def drive_home | |
@a.start_car | |
@a.drive_to(@b) | |
@a.park | |
end | |
def oil_change | |
money = Person.first.money | |
@a = Dealership.buy_car(Person.first, money) | |
@a.start_car | |
@a.drive_to(@b) | |
@a.park | |
if(@a.weight > 5000) | |
puts 'big car' | |
if(@a.tires.pressure < 24) | |
if(@a.tires.wear > 60) | |
if(@a.tires.age > 24) | |
@a.tires.fill_to(35) | |
end | |
end | |
end | |
end | |
Car::Maintenance.perform_oil_change(@a) | |
end | |
def buy_car(a) | |
Dealership.buy_car(a) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment