AlexandrP

pcStore

Dec 14th, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function pcStore(input) {
  2.     let processorPrice = parseFloat(input[0]);
  3.     let videoCardPrice = parseFloat(input[1]);
  4.  
  5.     let ramPrice = parseFloat(input[2]);
  6.     let numRam = parseInt(input[3]);
  7.  
  8.  
  9.     let discountPercentage = parseFloat(input[4]);
  10.  
  11.  
  12.     let processorPriceLeva = processorPrice * 1.57;
  13.     let videoCardPriceLeva = videoCardPrice * 1.57;
  14.     let ramPriceLeva = ramPrice * 1.57;
  15.  
  16.     let processorPriceAfterDiscountLeva = processorPriceLeva * (1 - discountPercentage);
  17.     let videoCardPriceAfterDiscountLeva = videoCardPriceLeva * (1 - discountPercentage);
  18.  
  19.     let totalPriceLeva = processorPriceAfterDiscountLeva + videoCardPriceAfterDiscountLeva + ramPriceLeva * numRam;
  20.     console.log(`Money needed - ${totalPriceLeva.toFixed(2)} leva.`);
  21.   }
  22.   pcStore(["1200","850","120","4","0.1"]);
Add Comment
Please, Sign In to add comment