Advertisement
medical-boy-sf

Wedding Investment

Jan 25th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function weddingInvestment(periodContract, typeContract, desert, numberMonths) {
  2.     let monthTax = 0;
  3.  
  4.     if (periodContract === "one") {
  5.         if (typeContract === "Small") {
  6.             monthTax = 9.98;
  7.         } else if (typeContract === "Middle") {
  8.             monthTax = 18.99;
  9.         } else if (typeContract === "Large") {
  10.             monthTax = 25.98;
  11.         } else if (typeContract === "ExtraLarge") {
  12.             monthTax = 35.99;
  13.         }
  14.     } else {
  15.         if (typeContract === "Small") {
  16.             monthTax = 8.58;
  17.         } else if (typeContract === "Middle") {
  18.             monthTax = 17.09;
  19.         } else if (typeContract === "Large") {
  20.             monthTax = 23.59;
  21.         } else if (typeContract === "ExtraLarge") {
  22.             monthTax = 31.79;
  23.         }
  24.     }
  25.  
  26.     if (desert === "yes") {
  27.         if (monthTax > 30) {
  28.             monthTax += 3.85;
  29.         } else if (monthTax > 10) {
  30.             monthTax += 4.35;
  31.         } else {
  32.             monthTax += 5.5;
  33.         }
  34.     }
  35.  
  36.     let finalSum = numberMonths * monthTax;
  37.  
  38.     if (periodContract === "two") {
  39.         finalSum = finalSum - finalSum * 0.0375;
  40.     }
  41.  
  42.     console.log(`${finalSum.toFixed(2)} lv.`);
  43. }
  44.  
  45. weddingInvestment("two", "Small", "yes", 20);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement