Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function journey(input) {
- let bugdet = Number(input.shift());
- let season = input.shift();
- let expense = 0;
- let destination = 0;
- let typeAccomm = 0;
- if (bugdet <= 100) {
- destination = "Bulgaria";
- switch(season) {
- case "summer": expense = bugdet * 0.30; break;
- case "winter": expense = bugdet * 0.70; break;
- }
- } else if (bugdet <= 1000) {
- destination = "Balkans";
- switch(season) {
- case "summer": expense = bugdet * 0.40; break;
- case "winter": expense = bugdet * 0.80; break;
- }
- } else {
- destination = "Europe";
- expense = bugdet * 0.90;
- }
- if (season == "summer" && destination !== "Europe") {
- typeAccomm = "Camp";
- } else {
- typeAccomm = "Hotel";
- }
- console.log(`Somewhere in ${destination}`);
- console.log(`${typeAccomm} - ${expense.toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment