A Passenger is a registered traveller in the LYNX platform. Each Passenger is uniquely identified by their DNI (an 8-digit national identity number), which doubles as their login key. Once registered, a Passenger can request rides, select a service tier, review their full trip history, rate drivers, and monitor how much they have spent over time. Passenger records are persisted toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/yeremyacuna/LYNX/llms.txt
Use this file to discover all available pages before exploring further.
assets/passengers.txt between sessions.
Passenger Profile
Every Passenger record contains the following fields, sourced directly fromPassenger.h:
| Field | Type | Description | Default |
|---|---|---|---|
passengerId | string | Auto-generated identifier in the format PAS-XXXX (4 digits) | Generated on registration |
name | string | Full display name of the passenger | — |
dni | string | 8-digit national identity number used as the login key | — |
password | string | Login credential | — |
rating | float | Passenger rating, updated by drivers after each trip | 5.0 |
totalTrips | int | Cumulative number of completed trips | 0 |
totalSpent | float | Total fare paid across all completed trips | 0.0 |
trips | Queue<Trip>* | Pointer to a dynamically allocated queue of this passenger’s trips | Allocated on construction |
Passenger::syncNextPassengerId(int nextId), which re-synchronises the counter after loading saved data, ensuring IDs remain sequential even across restarts. The static method Passenger::generateNextPassengerId() generates the next sequential PAS-XXXX code using setw(4) zero-padding.
Registering a Passenger
Passengers self-register from the application’s main entry point. The system validates the DNI before creating the record.Open the Passenger entry screen
At the main menu, select “Soy pasajero” and then choose “Registrarme”.
Enter your full name
Type your full name when prompted. This is stored in the
name field of the Passenger object.Enter your DNI
Enter your 8-digit national ID. The system calls
AuthManager::validateDni(DNI) — any DNI that is not exactly 8 digits is rejected immediately.Logging In
DNI is the login key. The system callsAuthManager::loginUserValid(dni, password) to validate credentials. If the DNI and password match, the Passenger object is loaded and the Passenger menu opens.
Passenger Menu Actions
After a successful login the following actions are available, as defined inMainMenu.h:
- Solicitar un viaje — enter an origin, a destination, a fare tier (1: Eco, 2: Std, 3: Pre), and a distance in km. The system calculates the fare and presents a confirmation screen.
- Ver viaje activo — displays the currently running or pending trip, including route, fare tier, price, and the assigned driver.
- Historial de viajes — renders all completed trips for this passenger, filtered from the global history stack by the passenger’s DNI.
- Calificar ultimo conductor — after a trip completes, the passenger can award 1–5 stars. The rating is applied via
AuthManager::updateDriverRating(driverDni, stars). - Perfil — allows the passenger to change their display name and password by entering a new name and new password.
- Cerrar sesion — returns to the main menu and closes the Passenger session.
Trip Fare Tiers
When requesting a trip the passenger chooses one of three service tiers. Thetipe field on the Trip object stores the numeric value:
| Tier | tipe value | Description |
|---|---|---|
| Economy | 1 | Standard fare — base rate of S/ 1.20 per km plus a S/ 3.00 flat fee |
| Comfort | 2 | Mid-range fare — base rate of S/ 1.80 per km plus a S/ 3.00 flat fee |
| Premium | 3 | Luxury fare — base rate of S/ 2.50 per km plus a S/ 3.00 flat fee |
Trip::calcPrice(int tipo, float km):
The
trips field inside each Passenger object is a Queue<Trip>* — a pointer to a dynamically allocated queue. The copy constructor and assignment operator perform a deep clone of this queue via the private cloneTrips helper, so each passenger manages its own memory independently without sharing pointers with other objects.