Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function carToGo(input) {
- let budget = Number(input[0]);
- let season = input[1];
- let car = '';
- let classs = '';
- if (budget > 500) {
- car = `Jeep`;
- classs = `Luxury class`;
- budget *= 0.9;
- }
- else if (budget > 100 && budget <= 500) {
- if (season === `Summer`) {
- car = `Cabrio`;
- budget *= 0.45;
- }
- else {
- car = `Jeep`;
- budget *= 0.8;
- }
- classs = `Compact class`;
- }
- else if (budget > 0 && budget <= 100) {
- if (season === `Summer`) {
- car = `Cabrio`;
- budget *= 0.35;
- }
- else {
- car = `Jeep`;
- budget *= 0.65;
- }
- classs = `Economy class`;
- }
- console.log(classs);
- console.log(`${car} - ${budget.toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement