Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 978 Bytes

README.md

File metadata and controls

37 lines (30 loc) · 978 Bytes

composition example

Classes:

  1. Car:

    • Attributes: Make, model, Engine object, Transmission object.
    • Methods:
      • Constructor to initialize car attributes.
      • Start the car.
      • Stop the car.
  2. Engine:

    • Attributes: Type, horsepower.
    • Methods:
      • Constructor to initialize engine attributes.
      • Start the engine.
      • Stop the engine.
  3. Transmission:

    • Attributes: Type.
    • Methods:
      • Constructor to initialize transmission attributes.
      • Shift gear.

Composition:

  • Each car consists of an engine and transmission objects.

Main Functionality:

  • Car Operations:

    • Start the car by starting the engine.
    • Stop the car by stopping the engine.
  • Engine Operations:

    • Start the engine to power the car.
    • Stop the engine to turn off the car.
  • Transmission Operations:

    • Shift gears for acceleration or deceleration.