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

Qory-Pull Request for Iteration 3 & 4 - Park Class Implementation & Enhancements IC # 1 #14

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

Conversation

qoryhanisagal
Copy link

@qoryhanisagal qoryhanisagal commented Oct 23, 2024

Iteration 3 & 4 - Park Class Implementation and Enhancements

Overview

In Iteration 3 and 4, I implemented the Park class, which manages vehicles entering the park, tracks passengers, and calculates revenue based on adult passengers. Additionally, I enhanced the park's functionality to list all attendees, minors, and adults, all sorted alphabetically.

Key Features Implemented

Iteration 3:

  • Park Class:

    • Initialized with a name and admission_price.
    • Manages vehicles entering the park.
    • Tracks all passengers from vehicles that have entered the park.
  • Key Methods:

    • initialize: Initializes the park with name, admission_price, and an empty vehicles array.
    • add_vehicle: Adds a vehicle to the park.
    • passengers: Returns a list of all passengers from the vehicles in the park.
    • revenue: Calculates revenue based on the number of adult passengers and the admission price.

Iteration 4:

  • Additional Methods:
    • all_attendees: Returns a list of names of all attendees (passengers) sorted alphabetically.
    • minors: Returns a sorted list of minors (passengers under 18) in the park.
    • adults: Returns a sorted list of adults (passengers 18 and older) in the park.

Test Coverage

  • I used TDD to verify the behavior of the Park class:
    • Initialization of the park with the correct attributes.
    • Properly adding vehicles and passengers to the park.
    • Correctly listing all passengers, adults, and minors in the park.
    • Accurate calculation of revenue based on the number of adult passengers.
    • Sorting attendees, minors, and adults alphabetically.

Challenges

  • Handling edge cases such as no adults in the park and ensuring revenue is correctly calculated in such scenarios.
  • Ensuring that the sorting logic for attendees, minors, and adults works as expected with various input data.

Fixes

  • Addressed issues where revenue wasn't calculated correctly by counting adult passengers properly.
  • Ensured that the lists of attendees, minors, and adults are returned in alphabetical order.
  • Corrected tests where passenger counting was inaccurate due to missing or incorrect test expectations.

Reflection

  • Successfully implemented the full Park class functionality with all requested features and enhancements.
  • The class is fully tested, and all tests have passed, ensuring correct behavior of all methods, including edge cases and sorting logic.

@qoryhanisagal qoryhanisagal changed the title Qory-Pull Request Qory-Pull Request for IC # 1 Oct 23, 2024
@qoryhanisagal qoryhanisagal changed the title Qory-Pull Request for IC # 1 Qory-Pull Request for Independent Challenge # 1 Oct 23, 2024
@qoryhanisagal qoryhanisagal changed the title Qory-Pull Request for Independent Challenge # 1 Qory-Pull Request for Iteration 3 & 4 - Park Class Implementation & Enhancements IC # 1 Oct 23, 2024
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