Advertisement
desito07

Hotel Room

Mar 2nd, 2020
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function Hotel(input) {
  2. let month = input.shift();
  3. let count = Number(input.shift());
  4.  
  5. let priceap = 0;
  6. let pricest = 0;
  7.  
  8. if (month == "May" || month == "October") {
  9. priceap = 60 * count;
  10. pricest = 50 * count;
  11. if (count >= 14) {
  12. pricest *= 0.7;
  13. } else if (count >= 7) {
  14. pricest *= 0.95;
  15. }
  16. } else if (month == "June" || month == "September") {
  17. priceap = 68.7 * count;
  18. pricest = 75.2 * count;
  19. if (count >= 14) {
  20. pricest *= 0.8;
  21. }
  22. } else if (month == "July" || month == "August") {
  23. priceap = 77 * count;
  24. pricest = 76 * count;
  25. }
  26. if (count >= 14) {
  27. priceap *= 0.9;
  28. }
  29. console.log(`Apartment: ${priceap.toFixed(2)} lv.`);
  30. console.log(`Studio: ${pricest.toFixed(2)} lv.`);
  31. }
  32. Hotel(["May", "15"]);
  33. Hotel(["June", "14"]);
  34. Hotel(["August", "20"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement