Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function skiBansko(input) {
- let days = Number(input.shift());
- let roomType = input.shift();
- let feedback = input.shift();
- let nights = 0;
- let totalSum = 0;
- let total = 0;
- if (roomType === "room for one person") {
- if (days < 10) {
- nights = days - 1;
- totalSum = nights * 18.00;
- total = totalSum;
- } else if (days >= 10 && days < 15) {
- nights = days - 1;
- totalSum = nights * 18.00;
- total = totalSum;
- } else {
- nights = days - 1;
- totalSum = nights * 18.00;
- total = totalSum;
- }
- } else if (roomType === "apartment") {
- if (days < 10) {
- nights = days - 1;
- totalSum = nights * 25.00;
- total = totalSum - totalSum * 0.30;
- } else if (days >= 10 && days < 15) {
- nights = days - 1;
- totalSum = nights * 25.00;
- total = totalSum - totalSum * 0.35;
- } else {
- nights = days - 1;
- totalSum = nights * 25.00;
- total = totalSum - totalSum / 0.5;
- }
- } if (roomType === "president apartment") {
- if (days < 10) {
- nights = days - 1;
- totalSum = nights * 35.00;
- total = totalSum - totalSum * 0.10;
- } else if (days >= 10 && days < 15) {
- nights = days - 1;
- totalSum = nights * 35.00;
- total = totalSum - totalSum * 0.15;
- } else {
- nights = days - 1;
- totalSum = nights * 35.00;
- total = totalSum - totalSum * 0.2;
- }
- } if (feedback === "positive") {
- total = total + total*0.25;
- } else {
- total = total - total*0.10;
- }
- console.log(((total).toFixed(2)))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement