//Superclass constructor
var Tea = function(options) {
    this.color = options.color || "herbal";
    this.caffeine = options.caffeine || 0;
    this.tannins = options.tannins || 0;
    this.minsSteeped = 0;
}

//Superclass prototype
//Put methods and static variables in here
Tea.prototype = {
  steep : function(cup) {
      //caffeine
      this.caffeine = Math.max(0, this.caffeine - 1);
      if (this.caffeine) {
        cup.caffeine ++;
      }
      //tannins
      cup.tannins += this.tannins * this.minsSteeped;
      //color
      cup.color = this.color;
      //minsSteeped
      this.minsSteeped ++;
  }
};

//Subclass constructor
var BlackTea = function(){
    //Put instance properties from the superclass constructor on the subclass instance
    Tea.call(this, {
        color : "Black",
        caffeine : 10,
        tannins : 3
    });
    this.hasMilk = false;
}

//The BlackTea prototype should be an object whose prototype is the same as Tea's prototype
BlackTea.prototype = Object.create(Tea.prototype);

//Since it's a new object though, we can modify it without modifying any other types of Tea
BlackTea.prototype.addMilk = function(cup) {
    //adding milk makes the cup of tea less harsh!
    cup.tannins = Math.floor(cup.tannins / 2);
    this.hasMilk = true;
}

//ok, let's make some tea
var myTea = new BlackTea();

var myCup = {
    color : "clear",
    caffeine : 0,
    tannins : 0
};

//steep for three minutes
myTea.steep(myCup);
myTea.steep(myCup);
myTea.steep(myCup);

//add some milk
myTea.addMilk(myCup);

console.log(myCup, myTea);