Advertisement
Liliana797979

viarno reshenie mobile operator

Feb 18th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2. function mobileOperator(input) {
  3.     let period = input[0];
  4.     let type = input[1];
  5.     let internet = input[2];
  6.     let months = Number(input[3]);
  7.     let tax = 0;
  8.  
  9.     if(type === "Small") {
  10.         if(period === "one") {
  11.             tax = months * 9.98
  12.         } else {
  13.             tax = months * 8.58;
  14.         }
  15.         if(internet === "yes") {
  16.             tax += months * 5.50;
  17.         }
  18.     } else if(type === "Middle") {
  19.         if(period === "one") {
  20.             tax = months * 18.99
  21.         } else {
  22.             tax = months * 17.09;
  23.         }
  24.         if(internet === "yes") {
  25.             tax += months * 4.35;
  26.         }
  27.     } else if(type === "Large") {
  28.         if(period === "one") {
  29.             tax = months * 25.98
  30.         } else {
  31.             tax = months * 23.59;
  32.         }
  33.         if(internet === "yes") {
  34.             tax += months * 4.35;
  35.         }
  36.     } else if(type === "ExtraLarge") {
  37.         if(period === "one") {
  38.             tax = months * 35.99
  39.         } else {
  40.             tax = months * 31.79;
  41.         }
  42.         if(internet === "yes") {
  43.             tax += months * 3.85;
  44.         }
  45.     }
  46. if(period === "two") {
  47.     tax = tax - tax * 0.0375;
  48. }
  49. console.log(`${tax.toFixed(2)} lv.`);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement