Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function journey(input) {
- let budget = Number(input[0]);
- let season = input[1];
- // "summer" or "winter"
- let totalSum;
- let destination;
- let vacationType;
- if (budget <= 100) {
- destination = "Bulgaria";
- if (season == "summer") {
- vacationType = "Camp";
- totalSum = budget * 0.70;
- } else {
- vacationType = "Hotel";
- totalSum = budget * 0.30;
- }
- } else if (budget > 1000){
- destination = "Europe";
- vacationType = "Hotel";
- totalSum = budget * 0.1;
- } else {
- destination = "Balkans";
- if (season == "summer") {
- vacationType = "Camp";
- totalSum = budget * 0.6;
- } else {
- vacationType = "Hotel";
- totalSum = budget * 0.2;
- }
- }
- let money_left = budget - totalSum;
- console.log(`Somewhere in ${destination}`);
- console.log(`${vacationType} - ${money_left.toFixed(2)}`);
- }
Add Comment
Please, Sign In to add comment