Don't know where I get wrong with my register


Can someone help me to take a look for me?
I got the error message"Oops, try again. Did you remember to add cases for magazine and chocolate? Are all your prices accurate?"

My total came out right. I can't figure it out where I got wrong...........

var cashRegister = {
    total: 0,
//insert the add method here    
    add : function(itemCost){ += itemCost; 
    scan: function (item,quan) {
        switch (item) { 
        case "eggs": 
            this.add(0.98 * quan); 
        case "milk": 
            this.add(1.23 * quan); 
        //Add other 2 items here
        case "magazine":
            this.add(4.99 * quan);
        case "chocolate":
            this.add(0.45 * quan);
        return true;

//Scan 2 eggs and 3 magazines
cashRegister.scan("eggs", 2);
cashRegister.scan("magazine", 3);
//Show the total bill
console.log('Your bill is ';


adding too much code (quan) will trigger error. Remove quan and simply call the scan method multiply times.

You will work on a good way to work with quantities later.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.