Skip to content

mmbauskar/parking-lot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Parking Lot

Problem statment

I own a parking lot that can hold up to 'n' cars at any given point in time. Each slot isgiven a number starting at 1 increasing with increasing distance from the entry point insteps of one. I want to create an automated ticketing system that allows my customersto use my parking lot without human intervention.

When a car enters my parking lot, I want to have a ticket issued to the driver. The ticketissuing process includes us documenting the registration number (number plate) andthe colour of the car and allocating an available parking slot to the car before actuallyhanding over a ticket to the driver (we assume that our customers are nice enough toalways park in the slots allocated to them). The customer should be allocated a parkingslot which is nearest to the entry. At the exit the customer returns the ticket which thenmarks the slot they were using as being available.

Due to government regulation, the system should provide me with the ability to find out

  • Registration numbers of all cars of a particular colour.
  • Slot number in which a car with a given registration number is parked.
  • Slot numbers of all slots where a car of a particular colour is parked.

We interact with the system via a simple set of commands which produce aspecific output. Please take a look at the example below, which includes all thecommands you need to support - they're self explanatory. The system shouldallow input in one way.

It should provide us with an interactive command prompt based shellwhere commands can be typed in

Example: Interactive

To run the program and launch the shell

Assuming a parking lot with 6 slots, the following commands should be run in sequenceby typing them in at a prompt and should produce output as described below thecommand. Note that ​​exit​​terminates the process and returns control to the shell.

$​ create_parking_lot 6
    Created a parking lot with 6 slots
$​ park KA-01-HH-1234 White
    Allocated slot number: 1
$​ park KA-01-HH-9999 White
    Allocated slot number: 2
$​ park KA-01-BB-0001 Black
    Allocated slot number: 3
$​ park KA-01-HH-7777 Red
    Allocated slot number: 4
$​ park KA-01-HH-2701 Blue
    Allocated slot number: 5
$​ park KA-01-HH-3141 Black
    Allocated slot number: 6
$​ leave 4
    Slot number 4 is free

Commands supported are

  • exit
  • park
  • leave
  • status
  • create_parking_lot
  • slot_numbers_for_cars_with_colour
  • slot_number_for_registration_number
  • registration_numbers_for_cars_with_colour

To run the app,

Go To parking-log and run python parking_lot then enter the commands one by one etc.

About

parking-lot exercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages