Giter Site home page Giter Site logo

iterators_hmwk's Introduction

Iterator Challenge

Take a look at my_utils.js. Right now it only has a myEach function. Add the other iterators you built during the lecture: i.e. myMap, myReduce. The goal of this exercise is for you to 1) use the utilities you've already built to solve the problems in this exercise, 2) build and extend the myUtils library with additional helper functions. You also get to practice jQuery!

###Workflow & Submission

  • Fork this repository.
  • Clone the iterators_hmwk repo from your gitHub account onto your computer.
  • Open cash_register\cash_register.html in your browser to see the current version of our site.
  • Make changes to the files in the cash_register subdirectory of your local repo:
    • Write your new helper functions in my_utils.js.
    • Add to cash_register.js to meet the goals below. Use the functions from your library!
  • git add and git commit your changes as you go. Remember to say what you did in your commit messages!
  • git push to update the repo on your gitHub account.
  • Submit the link to the iterators_hmwk repo on your gitHub account.

###Goals

  • Use the iterators you've already built. Build new helper functions using your library (see below)!
  • By the end of this homework you should have used: myReduce, myMap, and myEach at a minimum!

Calucations

  1. Set SUBTOTAL to the sum of the prices.
  2. Bonus: SALES TAX is 7.25%.
  3. Bonus: TOTAL should reflect SUBTOTAL + SALES TAX.

Formatting

  1. Sort(!) the receipt alphabetically.
  2. Fix the random capitalization in titles.
  3. If the line items contain(!) a refund, print "Contains Refund" somewhere on the receipt.
  4. Returns / Refunds: If a number is negative, turn it red!

Bonuses

  1. Zepplins are on sale! Filter(!) for "Zepplin" in the title and discount them 10%.
  2. Coupons! Check to see if any of the coupons apply to the line items.
  3. Super Bonus: Take a look at cash_register.html. See the commented out form element? Add it back in. Can you dynamically add items to the receipt?

Helper Functions

Write your new helper functions in cash_register/myUtils.js.

  • Create a helper function which takes in an HTML tag type and an inner HTML string and outputs an HTML element as a string.

        myUtils.buildElement("p", "Words words words")
        // "<p>Words words words</p>"
    
  • Create a helper function which takes in a float and returns a currency amount (remove extra decimal places).

        myUtils.toDollarAmount(12.971)
        // 12.97
    
  • Create a helper function which takes in a float and a currency symbol and returns a correctly formatted currency string.

        myUtils.toCurrencyString(12.971, "$")
        // $12.97
    
        myUtils.toCurrencyString(.97, "$")
        // $0.97
    

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.