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

Iteration 2 vehicle #12

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

qoryhanisagal
Copy link

Iteration 2 - Vehicle Class Implementation

Overview

In this iteration, I implemented the Vehicle class, which represents a vehicle with passengers and tracks whether it is speeding. The class includes methods to add passengers, check speeding status, and count adult passengers.

Key Features Implemented

  • Vehicle Class:

    • Initialized with year, make, and model attributes.
    • Tracks whether the vehicle is speeding.
    • Manages passengers inside the vehicle.
  • Key Methods:

    • initialize: Initializes the vehicle with year, make, and model, and defaults for speeding and passengers.
    • speeding?: Returns whether the vehicle is speeding.
    • speed: Sets the vehicle to speeding.
    • add_passenger: Adds a passenger to the vehicle.
    • num_adults: Returns the number of adult passengers in the vehicle.

Test Coverage

  • I used TDD to ensure the Vehicle class behaves as expected:
    • Initialization of vehicles with the correct attributes.
    • Correctly tracking speeding status.
    • Adding passengers and correctly counting the number of adults.

Challenges

  • Handling missing attributes during initialization (e.g., nil values for year).
  • Ensuring accurate counting of adult passengers in the vehicle.

Fixes

  • Addressed failing tests related to missing attributes by adding default values.
  • Ensured that the speeding? method reflects the vehicle’s true speeding status after calling the speed method.
  • Corrected test expectations for the number of adult passengers.

Reflection

  • Successfully implemented all features for the Vehicle class using TDD.
  • All tests have passed, and the class is ready for further integration with the rest of the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant