Coder Social home page Coder Social logo

wdi_7_js_hw_mbta's Introduction

#Title: MBTA Homework, JavaScript!

Objectives:

  • Practice with array operations, intersections, etc., and working with arrays and properties of an object literal.

Activity:

  • Create a program that models a simple subway system.
  • The program takes the line and stop that a user is getting on at and the line and stop that user is getting off at and prints the total number of stops for the trip.
  • There are 3 subway lines:
    • The Red line has the following stops: south station, park st, kendall, central, harvard, porter, davis, alewife
    • The Green line has the following stops: haymarket, government center, park st, bolyston, arlington, copley
    • The Orange line has the following stops: north station, haymarket, park st, state, downtown crossing, chinatown, back bay, forest hills
    • All 3 subway lines intersect at park st, but there are no other intersection points. Some of this MBTA is fictionalized. Haymarket does not connect the orange/green lines.

Hints:

  • Assume good user input. Don't do lots of checking to ensure good input
  • Write all methods as functionally as possible. Separate your input, output and calculation. Attempt to not overwrite variables when possible. Write many methods.
  • You should be able to try to calculate the distance in your code without user input, but in the end we'll want user input.
  • You need to prompt the user for four pieces of input data.
  • Don't capture the user in a while loop. Let the program exit after one calculation.
  • Consider diagraming the lines by sketching out the subway lines and their stops and intersection.
  • Make subway lines are properties in an object literal, while the values are an array of all the stops on each line.
  • The key to the lab is to find the intersection of the lines at park st.
  • Make sure the stops that are the same for different lines have different names (i.e. Orange/Haymarket and Green/Haymarket need to be differentiated)

wdi_7_js_hw_mbta's People

Contributors

ga-meb avatar tibbon avatar

Watchers

 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.