Estacionamiento
Crea una clase ParkingLot
que administre el estacionamiento de autos. Esta clase tiene varias funcionalidades: debe poder estacionar un auto, liberar un auto y reportar el número de lugares de estacionamiento disponibles.
Crea una clase Car
que represente un auto que pueda ser estacionado en el estacionamiento.
Necesitas implementar lo siguiente:
Una clase
Car
, con un atributocar_id
: debe proporcionarse cuando se crea el objeto de auto. Todas las operaciones siguientes deben tener en cuenta elcar_id
.Una clase
ParkingLot
con:total_spots
attribute: the total number of parking spots in the parking lot, which should be provided when the parking lot object is created.park(car)
method: parks aCar
object in the parking lot. If the parking lot is full, it should printParking lot is full
.release(car)
method: releases aCar
from the parking lot. If the car is not in the parking lot, it should printCar not found in the parking lot
.spots_left()
method: returns an integer representing the number of available parking spots in the parking lot.
Entrada | Salida |
---|---|
| 2 1 0 1 |
| 1 Car not found in the parking lot 1 0 Parking lot is full 0 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB