Skip to content

manish-rajpurohitt/parking-lot-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parking-lot-assignment

Setup:

  1. Install NodeJs
  2. node index.js

Data Storing Structure:



ParkingLot : {
  numOfLevels: x,
  numOfRowsInEachLevel: x,
  numOfSlotsInEachRow: x,
  levels: [ Level, Level ] 
}

Level : { 
    totalRows: x, 
    rowSize: x, 
    rows: [ [Row], [Row], [Row] ] 
}

Row : {
    totalSpots: x, 
    remainingSpots: x,
    vehiclesOccupied: [ Vehicle, Vehicle ] 
}

Vehicle : {
    vehicleType: 'VEHICLE_TYPE',
    regNum: 'REGISTERED_NUMBER',
    fromTime: 'DEFAULT_TIME_NOW',
    spotSize: 'SLOT_SIZE'
}

Slot Size : { 
  MOTOR_CYCLE : 1,
  CAR : [3 , 5],
  BUS : 25
}
  

How to use:

  1. Import ParkingLot and Vehicle.
const parkingLotModule = require('./ParkingLot')
const ParkingLot = parkingLotModule.parkingLot;
const Vehicle = parkingLotModule.vehicle;
  1. Create a Parking Lot with relevant levels, number of rows in each level and number of slots in each row.
let parkingLot = new ParkingLot(numOfLevels,numOfRowsInEachLevel,numOfSlotsInEachRow);
parkingLot.createParkingLot();
  1. Create Vehicle's with Registered Number and Type of Vehicle.
let vehicleObj = new Vehicle(typeOfVehicle,registeredNumber); // Vehicle("CAR","REG-NUM-01");
  1. Store Vehicle's in Parking Lot.
parkingLot.parkVehicle(vehicleObj);
  1. Get number of vehicle's in Parking Lot.
parkingLot.status();
  1. Get empty spots of Parking Lot.
parkingLot.getEmptySpots();
  1. Get Location of Vehicle with Registered Number.
parkingLot.getVehicleLocation("REG-NUM-01");
  1. Leave or Exit Vehicle from Parking Lot with Registered Number.
parkingLot.leave("REG-NUM-01");

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published