Advertisement
Spocoman

Cat Shirt

Jan 7th, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function catShirt(input) {
  2.     let sleeveSize = Number(input.shift());
  3.     let frontSize = Number(input.shift());
  4.     let fabricTypes = input.shift();
  5.     let tieOrNot = input.shift();
  6.  
  7.     let sum = (sleeveSize * 2 + frontSize * 2) * 1.1 / 100;
  8.  
  9.     if (fabricTypes === "Linen") {
  10.         sum *= 15;
  11.     } else if (fabricTypes === "Cotton") {
  12.         sum *= 12;
  13.     } else if (fabricTypes === "Denim") {
  14.         sum *= 20;
  15.     } else if (fabricTypes === "Twill") {
  16.         sum *= 16;
  17.     } else if (fabricTypes === "Flannel") {
  18.         sum *= 11;
  19.     }
  20.     sum += 10;
  21.  
  22.     if (tieOrNot === "Yes") {
  23.         sum *= 1.2;
  24.     }
  25.     console.log(`The price of the shirt is: ${sum.toFixed(2)}lv.`);
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement