Open In App

Class Diagram for Bus Stand Management System

Improve
Improve
Like Article
Like
Save
Share
Report

A bus stand is a place where all buses will be available for transportation within a state and among other states. In this article, we’ll see about the bus stand management of a typical Indian bus stand along with its class diagram.

Classes :

  • BusStandManagement –  This class contains the details about the bus stand.
  • Employee – This class gives us the details of all the employees working for the bus stand including retailers, support staff, etc. This class is the parent class of Driver, Conductor and Maintenance staff since they all are employees.
  • Driver – Driver is the child class of employee. It gives the details of all the bus drivers in the bus stand.
  • Conductor – Conductor is the child class of employee. This gives us the bus conductor details.
  • Maintenance Staff – Maintenance staff is the child class of employee. It gives the details of all the maintenance staff.
  • Parking – Mostly all bus stand will have a parking space alongside. This class gives us the details of the parking lot, the information about the vehicles and the owner of the vehicles.
  • BusParking– Bus parking is the child class of parking. It is the space in which buses used to be parked. In India, buses to specific places will have some allocated area in the bus stand, so those buses need to be parked there.
  • VehicleParking – VehicleParking is the child class of parking. It contains the details of other vehicles in the bus stand like two-wheelers, cars and autos.
  • TravelAgency – These are the agencies which would be selling tickets for long-distance buses. It has two child classes GovernmentAgency and PrivateAgency.
  • GovernmentAgency – It is the child class of TravelAgency. It contains the details of the government agency incharge and the government buses available for long travel.
  • PrivateAgency – It is the child class of TravelAgency. It contains the details of the non-government buses and travel services available for booking long travel tickets.
  • Bus – This class gives us the details of the bus in the bus stand, it helps us to get a ticket to that bus and get information about the seats.
  • Passengers – This class gives information about the passengers of the bus stand.
  • Ticket – This holds the information about the ticket booked for travelling. It would contain the passenger details and the bus along with the timing of the travel.
  • Shops – This class contains the details of all the shops which would be present inside the bus stand.

Attributes:

  • BusStandManagement –  BusStandName, City, Area
  • Employee – EmployeeId, EmployeeName, EmployeeDesignation, EmployeeSalary
  • Driver – BusId
  • Conductor – BusId
  • MaintenanceStaff – Department
  • Parking – NoOfFreeBusSlots NoOfFreeOtherSlots,,
  • BusParking – SlotId, PlaceName, ArrivalTime, DepartureTime
  • VehicleParking – ParkingId, OwnerName, VehicleType, VehicleNumber, StartTime, EndTime
  • TravelAgency – AgencyName, TotalBuses
  • GovernmentAgency – InchargeId
  • PrivateAgency – InchargeId, InchargeContact
  • Bus – BusId, BusType, DriverId,ConductorId, TotalSeats, SeatsFilled, Source, Destination, TicketPrice,SlotId
  • Passengers – PassengerId, PassengerName, PassengerAge, PassengerGender, Source, Destination, BusId
  • Ticket – TicketId, BusId, PassengerId, Ticket Price
  • Shops – ShopId, ShopName, OwnerId

Methods:

1. BusStandManagement : 

  • IsOpen() – This method says whether the bus stop is functioning or not.

2. Employee:  

  • EmployeeDetails() – This method fetches the employee details.

3. Parking:  

  • ParkVehicle() – This method is to park the vehicle.
  • Pay() – Pay method is to pay the fees for parking.

4. TravelAgency

  • GetAvailableBuses() – This method shows the buses available for traveling.
  • BookTicket() – This method books the ticket for us.

5. Bus  

  • BusDetails() – This method gives information about a specific bus.
  • GetTicket() – This method helps us to book tickets for that specific bus.

6. Passengers

  • PassengerDetails() – This method is to get the details of a specific passenger.

7. Ticket  

  • TicketDetails() – Ticket details of a specific passenger can be viewed using this method.
  • isPaid()– This method shows whether the passenger purchased and paid for the ticket.

8. Shops  

  • ShopDetails() – It displays the shops of the bus stand along with the items available there.
  • Buy() – This method is to purchase the items in those shops.

Relationship:

1. Inheritance:

        Inheritance is the practice of acquiring the required properties from one class to another class. The class which acquires the properties is known as the child class. The class which allows its properties to be acquired is known as the parent class. It is simply known as the Parent-child relationship. Ie. “Is-a” relationships

Here,  

1. Driver, Conductor, MaintenanceStaff is the child class of Employee.

  • Driver is a Employee
  • Conductor is a Employee
  • MaintenanceStaff is a Employee

     It correctly satisfies “is-a” relationship

2. GovernmentAgency and PrivateAgency is the child class of TravelAgency

  • GovernmentAgency is a TravelAgency
  • PrivateAgency is a TravelAgency

It correctly satisfies “is-a” relationship

3. BusParking and VehicleParking is the child class of  Parking

  • BusParking is a Parking
  • VehicleParking is a Parking

It correctly satisfies “is-a” relationship

2. Aggregation :

        In Aggregation, Class A and Class B are dependent on each other which indicates that A has an instance of B and B has an instance of B, but they are not physically contained inside each other. In simple terms, Class B can exist without  Class A. It follows “has-a” relationship.  

Here,

  • BusStandManagement and Shop – Shop can exist without Bus Stand.
  • BusStandManagement  and  Parking – Parking can exist without Bus Stand.
  • BusStandManagement  and  TravelAgency – TravelAgency can exist without Bus stand.
  • Ticket and Passenger – Passenger can exist without ticket.
  • Bus  and Passenger –  Passenger can exist without Bus.

follows Aggregation relation.

3. Composition :

     In composition, Class A and Class B are dependent on each other which indicates that class A has an instance of class B inside class A. In other words, class B is physically contained inside class A.  So class B cannot exist without class A. It follows “has-a” relationship.

Here,

  • Bus and Ticket – Ticket cannot exist without Bus

follow Composition relation.

4. Association :

       In Association, one class is not committed to the other class in any means, but both of the classes use each other and function in their own respective spaces. It follows the “using” relation.

Here,

  • Employee and Passenger – Employee uses Passenger, Passenger uses Employee.

follow Association relation.

5. Unidirectional Association :

          In unidirectional Association, two classes are related in some ways, but only one class makes use of the other class whereas the other class is not benefited from the relationship. Class A can call Class B whereas Class B cannot call Class A.

Here,  

  • Passenger and shops  – Passenger uses shops

follow unidirectional Association.

Notation :

Class Diagram :



Last Updated : 03 Nov, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads