Week 3 Homework

Your hot new rideshare startup, Noober, is about to launch its MVP. Your back-end engineering team has completed work on the API that provides data about rides, and you'd like to test it out by consuming it and producing a human-readable output.

Getting Started

Begin by heading over to the starter project – select "Use this template", then create a repository in your own GitHub account called hw3. Clone this project and open it in VSCode.

Open index.html in Chrome, then open the JavaScript console.

The Goal

Each time the page is refreshed, display a new, randomized ride in the JavaScript console. The random ride data is already provided – simply use the ride variable. The provided code writes out the value of this variable to the JavaScript Console in Chrome – inspect the structure of this data using the Console. Your job is to extract the data from this Object and provide human-readable output to the Console.

Business Rules/Rubric

With Noober, riders must specify the following data/criteria for their requested ride:

  1. Name
  2. Phone Number
  3. Pickup Location
  4. Dropoff Location
  5. Number of passengers in their party
  6. Whether or not they would like a luxury "Noober Purple" car

There is code already provided that properly runs when the page is loaded or refreshed. This code does the work of reaching out to the rides API and obtaining a random ride – you should not modify this existing code; rather, begin the implmentation of the following requirements starting on line 15 of the code:

  1. Parse the data given in the random ride Object, and present it in human-readable format, for example: Noober X Passenger: Kiley Thompson - (260) 908-6886. Pickup at 1301 N State Pkwy, Chicago, IL 60624. Drop-off at 2362 N Clybourn Ave, Chicago, IL 60657.
  2. (3 points) Approach the problem like we did in class – write the recipe (algorithm) using comments, then write the code according to the recipe.
  3. (3 points) Create a well-named variable for each data point in the Object. For example, passengerFirstName. Then, use these variables to construct your string of output to be written to the JavaScript console.
  4. (2 points) Use conditional logic – if the rider has requested the luxury "Purple" level of service, i.e. purpleRequested, display "Noober Purple" as the level of service, e.g. Noober Purple Passenger: Freeman Waters...
  5. (2 points) If the numberOfPassengers in a single ride request is greater than 3, we'll need to upgrade to a larger car. Display "Noober XL" as the level of service.
  6. A request for Noober Purple supercedes the Noober XL logic. In other words, if a Noober Purple has been requested, it doesn't matter how many passengers there are. Anything else is the normal level of service, "Noober X".

Guidelines for Submission

All your work should take place in noober.js; i.e. that should be the only file that's modified from the original project template. Your finished product should live in your GitHub account at https://github.com/<your GitHub username>/hw3, and this URL should be submitted as the "website URL" for this assignment in Canvas.