Skip to main content

Documentation 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.

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 to assets/passengers.txt between sessions.

Passenger Profile

Every Passenger record contains the following fields, sourced directly from Passenger.h:
FieldTypeDescriptionDefault
passengerIdstringAuto-generated identifier in the format PAS-XXXX (4 digits)Generated on registration
namestringFull display name of the passenger
dnistring8-digit national identity number used as the login key
passwordstringLogin credential
ratingfloatPassenger rating, updated by drivers after each trip5.0
totalTripsintCumulative number of completed trips0
totalSpentfloatTotal fare paid across all completed trips0.0
tripsQueue<Trip>*Pointer to a dynamically allocated queue of this passenger’s tripsAllocated on construction
The ID counter is managed by the static helper 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.
1

Open the Passenger entry screen

At the main menu, select “Soy pasajero” and then choose “Registrarme”.
2

Enter your full name

Type your full name when prompted. This is stored in the name field of the Passenger object.
3

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.
4

Set a password

Choose a login password. The credential is stored via the base User class.
5

Account is created

AuthManager::registerPassenger(name, DNI, password) generates a PAS-XXXX identifier using Passenger::generateNextPassengerId() and persists the new record to assets/passengers.txt.

Logging In

DNI is the login key. The system calls AuthManager::loginUserValid(dni, password) to validate credentials. If the DNI and password match, the Passenger object is loaded and the Passenger menu opens.
// From MainMenu.h — validating a passenger login
if (!authMgr.loginUserValid(DNI, password)) {
    mostrarMensaje("Datos incorrectos");
    option = 6;
    break;
}
Passenger currentPassenger = authMgr.getUserByDni(DNI);

Passenger Menu Actions

After a successful login the following actions are available, as defined in MainMenu.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. The tipe field on the Trip object stores the numeric value:
Tiertipe valueDescription
Economy1Standard fare — base rate of S/ 1.20 per km plus a S/ 3.00 flat fee
Comfort2Mid-range fare — base rate of S/ 1.80 per km plus a S/ 3.00 flat fee
Premium3Luxury fare — base rate of S/ 2.50 per km plus a S/ 3.00 flat fee
The fare calculation is performed in Trip::calcPrice(int tipo, float km):
// From Trip.h
float calcPrice(int tipo, float km) {
    float tarifa = 0.0f;
    if (tipo == 1) tarifa = 1.20f;
    else if (tipo == 2) tarifa = 1.80f;
    else                tarifa = 2.50f;
    price = tarifa * km + 3.0f;
    return price;
}
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.

Build docs developers (and LLMs) love