Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Tire.py #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Tire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Tire:
def __init__(self, tire_type, tire_wear_array):
self.tire_type = tire_type
self.tire_wear_array = tire_wear_array

def is_service_needed(self):
pass # This will be implemented in the subclasses


class CarriganTire(Tire):
def __init__(self, tire_wear_array):
super().__init__('Carrigan', tire_wear_array)

def is_service_needed(self):
# Check if any tire's wear is greater than or equal to 0.9
return any(wear >= 0.9 for wear in self.tire_wear_array)


class OctoprimeTire(Tire):
def __init__(self, tire_wear_array):
super().__init__('Octoprime', tire_wear_array)

def is_service_needed(self):
# Check if the sum of all tire wears is greater than or equal to 3
return sum(self.tire_wear_array) >= 3