Advertisement
Liliana797979

Lab1

Jan 25th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function demo(input) {
  2.  
  3.     let depositSum = Number(input[0]);
  4.     let depositPeriod = Number(input[1]);
  5.     let percent = Number(input[2]);
  6.  
  7.     let result = depositSum + depositPeriod * ((depositSum * percent / 100) / 12);
  8.  
  9.    
  10.     console.log(result);
  11.  
  12. }
  13.  
  14. demo(["200", "3", "5.7"]);
  15.  
  16.  
  17. function books(input) {
  18.  
  19.     let pagesCount = Number(input[0]);
  20.     let pages = Number(input[1]);
  21.     let daysCount = Number(input[2]);
  22.  
  23.     let totalTime = pagesCount / pages;
  24.     let hoursForDay = totalTime / daysCount;
  25.  
  26.     console.log(hoursForDay);
  27. }
  28.  
  29. books(["212", "20", "2"]);
  30.  
  31.  
  32. function birthday(input) {
  33.  
  34.     let rent = Number(input[0]);
  35.     let cakePrice = rent * 0.2;
  36.     let drinksPrice = cakePrice - (cakePrice * 0.45);
  37.     let animatorPrice = rent / 3;
  38.  
  39.     let sum = rent + cakePrice + drinksPrice + animatorPrice;
  40.    
  41.     console.log(sum);
  42.  
  43. }
  44.  
  45. birthday(["2250"]);
  46.  
  47.  
  48. function charityCampany(input) {
  49.  
  50.     let daysCount = Number(input[0]);
  51.     let confectionersCount = Number(input[1]);
  52.     let cakeCount = Number(input[2]);
  53.     let wafflesCount = Number(input[3]);
  54.     let pancakesCount = Number(input[4]);
  55.  
  56.     let cakePrice = cakeCount * 45;
  57.     let wafflesPrice = wafflesCount * 5.80;
  58.     let pancakesPrice = pancakesCount * 3.2;
  59.  
  60.     let sumForDay = (cakePrice + wafflesPrice + pancakesPrice) * confectionersCount;
  61.     let totalSum = sumForDay * daysCount;
  62.     let sum = totalSum - (totalSum / 8);
  63.  
  64.     console.log(sum);
  65.  
  66. }
  67.  
  68. charityCampany(["23", "8", "14", "30", "16"]);
  69.  
  70.  
  71. function fruitMarket(input) {
  72.  
  73.     let strawberriesPrice = Number(input[0]);
  74.     let bananasCountKg = Number(input[1]);
  75.     let orangesCountKg = Number(input[2]);
  76.     let raspberriesCountKg = Number(input[3]);
  77.     let strawberriesCountKg = Number(input[4]);
  78.  
  79.     let raspberriesPriceKg = strawberriesPrice / 2;
  80.     let orangesPriceKg = raspberriesPriceKg - (raspberriesPriceKg * 0.4);
  81.     let bananasPriceKg = raspberriesPriceKg - (raspberriesPriceKg * 0.8);
  82.  
  83.     let raspberriesSum = raspberriesCountKg * raspberriesPriceKg;
  84.     let orangesSum = orangesCountKg * orangesPriceKg;
  85.     let bananasSum = bananasCountKg * bananasPriceKg;
  86.     let strawberriesSum = strawberriesCountKg * strawberriesPrice;
  87.  
  88.     let totalSum = raspberriesSum + orangesSum + bananasSum + strawberriesSum;
  89.  
  90.     console.log(totalSum);
  91.  
  92. }
  93.  
  94.  
  95. fruitMarket(["48", "10", "3.3", "6.5", "1.7"]);
  96.  
  97.  
  98. function aquarium(input) {
  99.     let length = Number(input[0]);
  100.     let width = Number(input[1]);
  101.     let height = Number(input[2]);
  102.     let percent = Number(input[3]);
  103.  
  104.     let aquariumVolume = length * width * height;
  105.     let totalLitres = aquariumVolume * 0.001;  
  106.     let totalPercent = percent * 0.01;
  107.     let litres = totalLitres * (1 - totalPercent)
  108.    
  109.  
  110.     console.log(litres);
  111.  
  112. }
  113.  
  114. aquarium(["85", "75", "47", "17"]);
  115.  
  116.  
  117. function convector(input) {
  118.  
  119.     let usd = Number(input[0]);
  120.     let bgn = usd * 1.79549;
  121.  
  122.     console.log(bgn);
  123.  
  124. }
  125.  
  126. convector([22]);
  127.  
  128.  
  129. function convectorRadiansInDegrees(input) {
  130.  
  131.     let radians = Number(input[0]);
  132.     let degrees = radians * 180 / (Math.PI);
  133.  
  134.     console.log(degrees.toFixed(0));
  135. }
  136.  
  137. convectorRadiansInDegrees(["3.1416"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement