Anus Oop Project 3rd Sem Final
Anus Oop Project 3rd Sem Final
Features of a TMS
Begin the process. Create an instance of the TMS • Input vehicle details
class
(license plate, model,
capacity).
• Store the vehicle in
the TMS.
This C++ program models a Transportation Management System that manages vehicles, drivers,
trips, and passengers. It allows users to input trip details and calculates the fare based on the
number of passengers.
1. Vehicle Class:
o Attributes:
▪ license Plate: A string representing the vehicle's license plate.
▪ model: A string for the vehicle's model.
▪ capacity: An integer indicating how many passengers the vehicle can
hold.
o Methods:
▪ Constructor to initialize the vehicle's data.
▪ display (): Outputs the vehicle's details.
▪ get Capacity (): Returns the vehicle's capacity.
Driver Class:
• Attributes:
o name: A string for the driver's name.
o license Number: A string for the driver's license number.
• Methods:
o Constructor to initialize the driver's data.
o Display (): Outputs the driver's details.
Trip Class:
• Attributes:
o Start Location and end Location: Strings for the trip's start and end points.
o vehicle: An instance of the Vehicle class.
o driver: An instance of the Driver class.
o passengers: A vector to store the names of passengers.
o Fare Rate: A double representing the fare rate per passenger.
o Total Fare: A double to hold the total fare for the trip.
• Methods:
o Constructor to initialize a trip with its details.
o Add Passenger (): Adds a passenger's name to the list.
o Calculate Fare (): Computes the total fare based on the number of passengers.
o Display (): Outputs details of the trip, including passengers and total fare
TMS Class:
• Attributes:
o vehicles, drivers, and trips: Vectors to store vehicles, drivers, and trips
respectively.
• Methods:
o Add Vehicle (): Adds a vehicle to the system.
o Add Driver (): Adds a driver to the system.
o Schedule Trip (): Schedules a trip by adding it to the trips vector.
o Display All (): Displays all vehicles, drivers, and trips in the system.
Main Function
1. Initialization:
o Creates an instance of the TMS class.
o Creates a Vehicle and a Driver, and adds them to the TMS.
2. User Input:
o Prompts the user to enter the start and end locations of the trip.
o Asks the user for the fare rate per passenger.
3. Trip Creation:
o Initializes a Trip object with the user-provided details.
o Checks if the number of passengers exceeds the vehicle's capacity.
o Prompts the user to enter the names of the passengers.
4. Fare Calculation:
o Calls calculate Fare () to compute the total fare based on the number of
passengers.
5. Display Results:
o Calls display All () to show all vehicles, drivers, and the trip details, including
the total fare.
Conclusion: -
The Transportation Management System (TMS) program effectively models the management of
vehicles, drivers, trips, and passengers using object-oriented programming principles. It allows users to
input trip details, calculate fares based on passenger counts, and display comprehensive trip
information. This modular design promotes easy maintenance and scalability, making it suitable for real-
world applications in transportation logistics. Overall, the TMS serves as a foundational example of how
software can streamline transportation operations.