GithubHelp home page GithubHelp logo

rorymcgit / airport_challenge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from makersacademy/airport_challenge

0.0 2.0 0.0 135 KB

Land and take off planes from an airport

License: Other

Ruby 100.00%

airport_challenge's Introduction

Air Traffic Control Challenge

        ______
        _\____\___
=  = ==(___-_-___)
          \_____\___________________,-~~~~~~~`-.._
          /     o o o o o o o o o o o o o o o o  |\_
          `~-.__       __..----..__                  )
                `---~~\___________/------------`````
                =  ===(_________)

I wrote this project over the weekend of Makers Academy Week 1. I was tasked with designing an air traffic control system using an object oriented approach in Ruby and TDD in RSpec. Planes can be instructed to land and take off from the airport, depending on the weather (which was randomised to be too stormy for a landing/take off 1 in 10 times).

Instructions for use:

  • Clone this repo
  • Run bundle to install dependencies
  • Run rspec to view unit tests and feature test

Example usage from the command line:

$ irb
irb(main):001:0> require './lib/airport.rb'
=> true
irb(main):002:0> port = Airport.new
=> #<Airport:0x007fb90610e7a0 @capacity=10, @plane_arr=[]>
irb(main):003:0> plane = Plane.new
=> #<Plane:0x007fb90601c6f8>
irb(main):004:0> port.instruct_to_land(plane)
=> #<Airport:0x007fb90610e7a0 @capacity=10, @plane_arr=[#<Plane:0x007fb90601c6f8>], @plane=#<Plane:0x007fb90601c6f8>>
irb(main):005:0> port.confirm_landed(plane)
=> "#<Plane:0x007fb90601c6f8> has landed."
irb(main):006:0> port.take_off(plane)
=> []
irb(main):007:0> port.confirm_takeoff(plane)
=> "#<Plane:0x007fb90601c6f8> has taken off."

User stories:

As an air traffic controller 
So I can get passengers to a destination 
I want to instruct a plane to land at an airport and confirm that it has landed 

As an air traffic controller 
So I can get passengers on the way to their destination 
I want to instruct a plane to take off from an airport and confirm that it is no longer in the airport

As an air traffic controller 
To ensure safety 
I want to prevent takeoff when weather is stormy 

As an air traffic controller 
To ensure safety 
I want to prevent landing when weather is stormy 

As an air traffic controller 
To ensure safety 
I want to prevent landing when the airport is full 

As the system designer
So that the software can be used for many different airports
I would like a default airport capacity that can be overridden as appropriate

Process:

The error handling is based on checking the passed plane against the plane array within the airport and against max capacity, as well as checking for storminess.

An edge case still exists where if confirm_takeoff is called passing in a plane which has never been at the airport, it will report that it has taken off. Perhaps this is just a badly worded return string, or maybe there should be a "planes that took off" array to check against so the airport has a log of the coming and goings.

All tests are grouped by context. The planes array is viewable from outside as some tests were built to rely on checking the size/if a plane is within the array, but this can be removed from the Airport class and will not result in any operational change.

airport_challenge's People

Contributors

tansaku avatar rorymcgit avatar silvabox avatar dbugsy avatar leoallen85 avatar spike01 avatar anitacanita avatar bebbs avatar michaellennox avatar mihailiviucojocar avatar nikeshashar avatar sjmog avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.