Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Journey(input) {
- let budget = Number(input.shift());
- let season = input.shift;
- let destination = "";
- let place = "";
- let price = 0.0;
- if (budget <= 100) {
- destination = "Bulgaria";
- if ((season = "summer")) {
- place = "Camp";
- price = budget * 0.3;
- } else if (season == "winter") {
- place = "Hotel";
- price = budget * 0.7;
- }
- } else if (budget <= 1000) {
- destination = "Balkans";
- if ((season = "summer")) {
- place = "Camp";
- price = budget * 0.4;
- } else if (season == "winter") {
- place = "Hotel";
- price = budget * 0.8;
- }
- } else if (budget > 1000) {
- destination = "Europe";
- place = "Hotel";
- price = budget * 0.9;
- }
- console.log(`Somewhere in ${destination}`);
- console.log(`${place} - ${price.toFixed(2)}`);
- }
- Journey(["50", "summer"]);
- Journey(["75", "winter"]);
- Journey(["312", "summer"]);
- Journey(["678.53", "winter"]);
- Journey(["1500", "summer"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement