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];
- let costs = 0;
- let place;
- if (budget <= 100) {
- console.log("Somewhere in Bulgaria");
- switch (season) {
- case "summer":
- place = "Camp";
- costs = budget * 0.30; break;
- case "winter":
- place = "Hotel";
- costs = budget * 0.70; break;
- }
- } else if (budget <= 1000) {
- console.log("Somewhere in Balkans");
- switch (season) {
- case "summer":
- place = "Camp";
- costs = budget * 0.40; break;
- case "winter":
- place = "Hotel";
- costs = budget * 0.80; break;
- }
- } else {
- console.log("Somewhere in Europe");
- place = "Hotel";
- costs = budget * 0.90;
- }
- console.log(`${place} - ${costs.toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment