text: /*****************************
  * CODING CHALLENGE 3
  */
  
  /*
  John and his family went on a holiday and went to 3 different restaurants. The bills were $124, $48 and $268.
  To tip the waiter a fair amount, John created a simple tip calculator (as a function). He likes to tip 20% of the bill when the bill is less than $50, 15% when the bill is between $50 and $200, and 10% if the bill is more than $200.
  In the end, John would like to have 2 arrays:
  1) Containing all three tips (one for each bill)
  2) Containing all three final paid amounts (bill + tip).
  (NOTE: To calculate 20% of a value, simply multiply it with 20/100 = 0.2)
  GOOD LUCK 😀
  */
  
  function tipCalculator(amount){
    var tipAmount;
    switch(true){
      case amount < 50: {
        tipAmount= (20/100) * amount;
        return tipAmount;
      }
      case amount > 50 && amount < 200:{
        tipAmount = (15/100) * amount;
        return tipAmount;
      }
      case amount > 200:{
        tipAmount = (10/100)* amount;
        return tipAmount;
      }
      default:{
        console.log('Amount is too low or not a valid amount.');
      }
    }
  }
  
  var bills = [124, 48, 268];
  var tipArray=[];
  var finalAmount=[];
  
  for(var bill in bills){
    console.log(bills[bill]);
    var tip = tipCalculator(bills[bill]);
    tipArray.push(tip)
    finalAmount.push(bills[bill] + tip);
  }
  
  console.log(tipArray);
  console.log(finalAmount);
  