Skip to content

Conversation

@4doctorstrange
Copy link

Add Ticketing system and Fee calculation strategy for Parking Lot System Design Solution in CPP.

New classes:
: ParkingTicket - will be generated once am empty parking spot is assigned
: FeeStrategy - Strategy fee class which lets subclasses to define their own fee calculation strategy
: FeeFlatRate - Inherits "FeeStrategy". Flat rate is used for fee is calculation.
: FeeVehicleBased- Inherits "FeeStrategy". Fee calculation rate is as per spot type for parked vehicle.

Modification in existing files:
U - ParkingLot.cpp/hpp: Necessary changes to include to generate ticket and display fee amount.
U - ParkingLotDemo.cpp : Passing Fee Strategy while creating Parking Lot object.

CLI OUPUT:

harshrajput@harshrajput-mbp parkinglot % ./exe
ls
Initial parking lot status:

Parking Lot Status:
Total Capacity: 7
Available Spots: 7
Occupied Spots: 0

Parking vehicles...

| Ticket Number : 1
| SpotID : 3
| Vehicle Number : CAR001

Parked successfully: Vehicle: Red Car (License: CAR001)

| Ticket Number : 2
| SpotID : 1
| Vehicle Number : MOTO001

Parked successfully: Vehicle: Black Motorcycle (License: MOTO001)

| Ticket Number : 3
| SpotID : 6
| Vehicle Number : TRUCK001

Parked successfully: Vehicle: White Truck (License: TRUCK001)

Parking Lot Status:
Total Capacity: 7
Available Spots: 4
Occupied Spots: 3

Detailed Occupancy:
Spot 1 (Compact): Occupied by Vehicle: Black Motorcycle (License: MOTO001)
Spot 2 (Compact): Available
Spot 3 (Regular): Occupied by Vehicle: Red Car (License: CAR001)
Spot 4 (Regular): Available
Spot 5 (Regular): Available
Spot 6 (Large): Occupied by Vehicle: White Truck (License: TRUCK001)
Spot 7 (Large): Available

Removing vehicle CAR001...
Amount Payable(Rs): 12
Removed successfully: Vehicle: Red Car (License: CAR001)

| Ticket Number : 4
| SpotID : 3
| Vehicle Number : CAR002

Parked successfully: Vehicle: Blue Car (License: CAR002)

Final parking lot status:

Parking Lot Status:
Total Capacity: 7
Available Spots: 4
Occupied Spots: 3

Detailed Occupancy:
Spot 1 (Compact): Occupied by Vehicle: Black Motorcycle (License: MOTO001)
Spot 2 (Compact): Available
Spot 3 (Regular): Occupied by Vehicle: Blue Car (License: CAR002)
Spot 4 (Regular): Available
Spot 5 (Regular): Available
Spot 6 (Large): Occupied by Vehicle: White Truck (License: TRUCK001)
Spot 7 (Large): Available
harshrajput@harshrajput-mbp parkinglot % ls

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