WOD: Bar Tab

Take out your WOD-velope and write today’s date and “Bar Tab” on your index card.

Implement two Javascript classes that together represent a “bar tab”—the drinks you have ordered at a bar and the total amount that you owe the bartender as a result.

The Tab class has the following methods:

For example, given the following code:

const maitai = new Drink("maitai", 12);
const beer = new Drink("beer", 6);
const tab = new Tab([maitai, maitai, beer, beer]);
console.log(tab.totalTab());   // Prints 36
console.log(tab.totalDrinks()); // Prints 4

Ready? Let’s begin:

  1. Login to JSFiddle.

  2. Create Javascript classes according to the specifications above.

  3. Informally test your program by invoking the example code above.

  4. When you are confident your code works correctly, press “Save” to create a URL to your JSFiddle.

  5. Raise your hand to let me know you have finished.

Rx: < 8 min Av: 8 - 16 min Sd: 16 - 20 min DNF: 20+ min

Submission instructions

After the WOD is over, you will submit your work using Laulima. When you login to your section of ICS 314 in Laulima, you should find an open assignment with the label “WOD”.

Your submission in Laulima must contain the following:

  1. The URL to your JSFiddle containing your program.
  2. A copy of your JSFiddle Javascript code pasted into the body of the submission window.

Do not edit your JSFiddle URL after the WOD is over. If the contents of the JSFiddle differ from the code in the body of the email, then the minimum penalty is that you will receive no credit for this WOD.

Do not discuss this WOD with members of 314 in the other section until after noon today. I create different WODs for each section, but discussing it creates a perception of unfair advantage. If I find you have shared information about the WOD with a student from another section, then the minimum penalty is that you will receive no credit for this WOD.

This page is also available via http://goo.gl/eZX3EL