/js-atc-challenge

Primary LanguageJavaScriptOtherNOASSERTION

General Assembly Logo

Air Traffic Control Challenge

Prerequisites

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Install dependencies.
  4. Create and checkout a new branch to work on.
  5. Fulfill the listed requirements.

Starter code is available in lib/challenge.js. A pull request is not required, but it is necessary if you want a code review.

You may wish to refer to FAQs related to forking, cloning.

Requirements

We have been contracted to write a software subsystem for an air traffic control system. This software manages a queue of aircrafts and prioritizes the orders of take offs and landings based on the aircraft's type and size. Write a constructor function, ATCQueue, that creates and manages the aircraft queue.

Aircrafts are represented by objects that have at least, but are not limited to, the following properties.

Property Value
type passenger or cargo
size small or large

The aircraft queue should implement the following interface.

Method Parameters Return Notes
aircraftCount() None Integer Count the number of aircrafts in the queue.
enqueue() Aircraft None Add an aircraft to the queue.
dequeue() None Aircraft Remove an aircraft from the queue and return it.

The process that manages the aircraft queue satisfies the following conditions.

  • There is no limit on the size of the aircraft queue.
  • Aircrafts are dequeued according to their priority.
    • Passenger aircrafts have higher priority than cargo aircrafts.
    • If two aircrafts have the same type but different sizes, then the large aircraft has a higher priority.
    • If there is more than one aircraft with the same type and size, then the aircraft that was enqueued earlier has higher priority.

You should be running grunt nag before diagnosing any bugs, since it finds some of the most common sources of errors. After grunt nag passes, you should run grunt test to run the included tests. Tests will tell you whether of not you've met these requirements.

Tasks

Developers should run these often!

  • grunt nag or just grunt: runs code quality analysis tools on your code and complains.
  • grunt reformat: reformats all your code in a standard style.
  • grunt test: runs any automated tests; may depend on grunt build.
  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.