function amountFor(aPerformance) {
    let amount = 0;
    switch (aPerformance.play.type) {
    case 'tragedy':
      amount = 40000;
      if (aPerformance.audience > 30) {
        amount = amount + 1000 * (aPerformance.audience - 30);
      }
      break;
    case 'comedy':
      amount = 30000;
      if (aPerformance.audience > 20) {
        amount = amount + (10000 + 500 * (aPerformance.audience - 20));
      }
      amount = amount + 300 * aPerformance.audience;
      break;
    default:
      throw new Error(`unknown type: ${aPerformance.play.type}`);
    }

    return amount;
  }
/**
     * calculate performance for play
     * @param {Object} aPerformance - a performance
     * @param {string} aPerformance.playID - invoice performances playID
     * @param {string} aPerformance.audience - invoice performances audience
     * @return {Number} amount
     */
calculate performance for play
@param {Object} aPerformance - a performance
@param {string} aPerformance.playID - invoice performances playID
@param {string} aPerformance.audience - invoice performances audience
@return {Number} amount
calculate performance for play @param { Object } aPerformance - a performance @param { string } aPerformance . playID - invoice performances playID @param { string } aPerformance . audience - invoice performances audience @return { Number } amount
function amountFor(aPerformance) {
    let amount = 0;
    switch (aPerformance.play.type) {
    case 'tragedy':
      amount = 40000;
      if (aPerformance.audience > 30) {
        amount = amount + 1000 * (aPerformance.audience - 30);
      }
      break;
    case 'comedy':
      amount = 30000;
      if (aPerformance.audience > 20) {
        amount = amount + (10000 + 500 * (aPerformance.audience - 20));
      }
      amount = amount + 300 * aPerformance.audience;
      break;
    default:
      throw new Error(`unknown type: ${aPerformance.play.type}`);
    }
    return amount;
  }
function amountFor ( aPerformance ) { let amount = 0 ; switch ( aPerformance . play . type ) { case 'tragedy' : amount = 40000 ; if ( aPerformance . audience > 30 ) { amount = amount + 1000 * ( aPerformance . audience - 30 ) ; } break ; case 'comedy' : amount = 30000 ; if ( aPerformance . audience > 20 ) { amount = amount + ( 10000 + 500 * ( aPerformance . audience - 20 ) ) ; } amount = amount + 300 * aPerformance . audience ; break ; default : throw new Error ( ` ${ aPerformance . play . type } ` ) ; } return amount ; }
calculate performance for play
 @param {Object} aPerformance - a performance
 @param {string} aPerformance.playID - invoice performances playID
 @param {string} aPerformance.audience - invoice performances audience
 @return {Number} amount
calculate performance for play @param { Object } aPerformance - a performance @param { string } aPerformance . playID - invoice performances playID @param { string } aPerformance . audience - invoice performances audience @return { Number } amount