Advertisement
dimoBs

ски почивка

Aug 30th, 2020
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function vaule(days, place, rate) {
  2.  
  3.     let discount = 1;
  4.     let nights = (days - 1);
  5.     place = place.toLowerCase();
  6.     rate = rate.toLowerCase();
  7.     let rfoa = 18.00 * nights;
  8.     let app = 25.00 * nights;
  9.     let prezidentApp = 35.00 * nights
  10.     let positive = 0.25;
  11.     let negative = 0.90;
  12.  
  13.  
  14.     if (place == "apartament") {
  15.  
  16.         if (days < 10) {
  17.             discoun = app * 0.70;
  18.         } else if (days >= 10 && days <= 15) {
  19.             discount = app * 0.65;
  20.         } else if (days > 15) {
  21.             discount = app * 0.50;
  22.         }
  23.     } else if (place == "president apartament") {
  24.         if (days < 10) {
  25.             discount = prezidentApp * 0.90;
  26.         } else if (days >= 10 && days <= 15) {
  27.             discount = prezidentApp * 0.85;
  28.         } else if (days > 15) {
  29.             discount = prezidentApp * 0.80;
  30.  
  31.         }
  32.  
  33.     } else if (place == "room for one person") {
  34.         discount = rfoa * discount;
  35.     }
  36.     if (rate == "positive") {
  37.         all = (discount + (positive * discount));
  38.     } else if (rate == "negative") {
  39.  
  40.         all = (negative * discount);
  41.     }
  42.  
  43.     console.log(all.toFixed(2));
  44. }
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. //vaule("14", "apartament", "positive");
  52. vaule("30", "president apartament", "negative");
  53. //vaule("12", "room for one person", "positive");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement