Add Ticketing system and Fee calculation strategy for Parking Lot System Design Solution in CPP #178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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