Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vacation(groupCount, type, day) {
- let price = 0;
- switch (day) {
- case "Friday":
- if (type === "Students") {
- price += 8.45 * groupCount;
- } else if (type === "Business") {
- price += 10.9 * groupCount;
- } else if (type == "Regular") {
- price += 15 * groupCount;
- }
- break;
- case "Saturday":
- if (type === "Students") {
- price += 9.8 * groupCount;
- } else if (type === "Business") {
- price += 15.6 * groupCount;
- } else if (type === "Regular") {
- price += 20 * groupCount;
- }
- break;
- case "Sunday":
- if (type === "Students") {
- price += 10.46 * groupCount;
- } else if (type === "Business") {
- price += 16 * groupCount;
- } else if (type === "Regular") {
- price += 22.5 * groupCount;
- }
- break;
- }
- if (type === "Students" && groupCount >= 30) {
- price = price - price * 0.15;
- } else if (type === "Business" && groupCount >= 100) {
- price = price - price / 10;
- } else if (type === "Regular" && groupCount >= 10 && groupCount <= 20) {
- price = price - price * 0.05;
- }
- console.log(`Total price: ${price.toFixed(2)}`);
- }
- vacation(100, "Business", "Sunday");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement