/parking-lot

Implementation of parking lot in java language

Primary LanguageJavaApache License 2.0Apache-2.0

Parking lot

Implementation of parking lot in java language

Requirements

  • JAVA 1.11
  • Maven 3

Build Instructions from source code

This project is built using Apache Maven.

Run the following command from the root of repository, to build the client JAR:

  • Clone the source:
$ git clone https://github.com/sumannewton/parking-lot.git
  • Build
$ mvn clean install

How to setup and run

./setup.sh

To start an interactive command prompt

./parking_lot.sh

Example:

Parking lot service is starting....
|-------------------------------------------------------------|
|                     PARKING LOT MANUAL                      |
|-------------------------------------------------------------|
| help                                                        |
| exit                                                        |
| create_parking_lot {SLOT_SIZE}                              |
| park {VEHICLE_REG_NO} {VEHICLE_COLOUR}                      |
| leave {VEHICLE_REG_NO}                                      |
| status                                                      |
| registration_numbers_for_cars_with_color {VEHICLE_COLOUR}   |
| slot_numbers_for_cars_with_color {VEHICLE_COLOUR}           |
| slot_number_for_registration_number {VEHICLE_REG_NO}        |
|-------------------------------------------------------------|
cmdline> create_parking_lot 3
Created a parking lot with 3 slots
cmdline> park KA-01-HH-1234 White
Allocated slot number: 1
cmdline> park KA-01-HH-9999 White
Allocated slot number: 2
cmdline> park KA-01-BB-0001 Black
Allocated slot number: 3
cmdline> park KA-01-HH-7777 Red
Sorry, parking lot is full
cmdline> leave 2
Slot number 2 is free
cmdline> status
Slot No	| Registration No 	| Colour
---------------------------------------
  1	| KA-01-HH-1234		| White
  3	| KA-01-BB-0001		| Black

cmdline> registration_numbers_for_cars_with_colour White
[KA-01-HH-1234]
cmdline> slot_numbers_for_cars_with_colour White
[1]
cmdline> slot_number_for_registration_number KA-01-HH-3141
Not found
cmdline> slot_number_for_registration_number KA-01-HH-1234
1
cmdline> exit
Shutting down app....

To run with input file having commands

./parking_lot.sh <<INPUT_FILE_HERE>>

Sample input file is here.

Usage / Manual

Usage can be found here

Bugs

Bugs can be reported using Github issues.