#K66622. Parking Lot System
Parking Lot System
Parking Lot System
You are required to implement a parking lot management system. The system supports the following operations:
-
(\textbf{addVehicle}) : Adds a vehicle of the specified type, where (\texttt{vehicleType}) can be Car, Motorcycle, or Truck. It outputs (\texttt{True}) if the vehicle is added successfully and (\texttt{False}) if the vehicle with the same number already exists.
-
(\textbf{removeVehicle}) : Removes the vehicle with the given number. It outputs (\texttt{True}) if removal is successful, otherwise (\texttt{False}).
-
(\textbf{getTotalVehicles}): Outputs the total number of vehicles currently in the parking lot.
-
(\textbf{isVehiclePresent}) : Checks whether the vehicle is present in the parking lot. Outputs (\texttt{True}) if it exists, otherwise (\texttt{False}).
-
(\textbf{getAllVehicles}): Lists all vehicle numbers in the order they were added, separated by a space.
Your program should process a series of commands from standard input and output each command's result to standard output.
inputFormat
The first line of input contains an integer (n) ((n \ge 1)) which indicates the number of commands. Each of the following (n) lines contains a command in one of the following formats:
• addVehicle • removeVehicle • getTotalVehicles • isVehiclePresent • getAllVehicles
Note: The commands are case-sensitive and the vehicle numbers are unique.
outputFormat
For each command, output the corresponding result on a new line. The outputs must appear in the same order as the commands provided in the input.## sample
5
addVehicle Car AB1234
addVehicle Motorcycle XYZ567
removeVehicle XYZ567
getTotalVehicles
isVehiclePresent AB1234
True
True
True
1
True
</p>