Professional Documents
Culture Documents
bank account. How would you identify the objects within each scenario and list their attributes and
behaviors?
Instructions:
1. Consider the given scenarios or concepts, such as a car, a book, and a bank account.
2. For each scenario, identify the objects present within it.
3. List the attributes (characteristics) that describe each object.
4. Enumerate the behaviors (actions) associated with each object.
5. Provide a brief explanation or description for each attribute and behavior listed.
6. Compare and discuss your findings with your classmate, considering any differences or
additional aspects identified.
7. The object must not be the same as your classmates.
8. Provide an example of simple Python (PL of your choice) code that demonstrates the object-
oriented approach to representing the object you've chosen.
Object: Bicycle
Attributes:
1. Color
2. Brand
3. Model
4. Number of Gears
5. Wheel Size
6. Material (Frame)
7. Weight
8. Price
Behaviors:
1. Start
2. Stop
3. Accelerate
4. Brake
5. Change Gear
6. Ring Bell (if equipped)
7. Adjust Seat Height
8. Check Tire Pressure
Using python
class Bicycle:
def __init__(self, color, brand, model, num_gears, wheel_size, material, weight, price):
self.color = color
self.brand = brand
self.model = model
self.num_gears = num_gears
self.wheel_size = wheel_size
self.material = material
self.weight = weight
self.price = price
def start(self):
print("The bicycle starts moving.")
def stop(self):
print("The bicycle comes to a stop.")
def accelerate(self):
print("The bicycle accelerates.")
def brake(self):
print("The bicycle brakes.")
def ring_bell(self):
print("Ding ding!")
def check_tire_pressure(self):
print("Checking tire pressure...")
# Accessing attributes
print("My bike is a", my_bike.color, my_bike.brand, my_bike.model)
print("It has", my_bike.num_gears, "gears and a wheel size of", my_bike.wheel_size)
print("It weighs", my_bike.weight, "kg and costs Php", my_bike.price)
# Performing actions
my_bike.start()
my_bike.accelerate()
my_bike.brake()
my_bike.change_gear(3)
my_bike.ring_bell()
my_bike.adjust_seat_height("medium")
my_bike.check_tire_pressure()