Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vacation(groupPeople, typeGroup, dayWeek) {
- const business = 'Business';
- const students = 'Students';
- const regular = 'Regular';
- const friday = 'Friday';
- const sunday = 'Sunday';
- const saturday = 'Saturday';
- let priceForOne = 0;
- if (dayWeek === friday) {
- if (typeGroup === students) {
- priceForOne = 8.45;
- } else if (typeGroup === business) {
- priceForOne = 10.90;
- } else if (typeGroup === regular) {
- priceForOne = 15;
- }
- } else if (dayWeek === saturday) {
- if (typeGroup === students) {
- priceForOne = 9.80;
- } else if (typeGroup === business) {
- priceForOne = 15.60;
- } else if (typeGroup === regular) {
- priceForOne = 20;
- }
- } else if (dayWeek === sunday) {
- if (typeGroup === students) {
- priceForOne = 10.46;
- } else if (typeGroup === business) {
- priceForOne = 16;
- } else if (typeGroup === regular) {
- priceForOne = 22.50;
- }
- }
- if (groupPeople >= 30 && typeGroup === students) {
- priceForOne *= 0.85;
- } else if (groupPeople >= 100 && typeGroup === business) {
- groupPeople -= 10;
- } else if (typeGroup === regular && groupPeople >= 10 && groupPeople <= 20) {
- priceForOne *= 0.95;
- }
- let totalPrice = priceForOne * groupPeople;
- console.log(`Total price: ${totalPrice.toFixed(2)}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement