gskorchev

volleyball

Jan 29th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function volleyball(input) {
  2.     let year = input.shift();
  3.     let holidays = Number(input.shift());
  4.     let weekendsInHomeTown = Number(input.shift());
  5.     let weeekendsInSofia = 0;
  6.     let gameDays = 0;
  7.     let totalGameDays = 0;
  8.    
  9.     weeekendsInSofia = 48 - weekendsInHomeTown;    
  10.     gameDays = weeekendsInSofia * (3.0 / 4);
  11.     holidays = holidays * (2.0 / 3);
  12.     totalGameDays = gameDays + holidays + weekendsInHomeTown;
  13.     if (year == "leap") {
  14.         totalGameDays = totalGameDays + (totalGameDays * 0.15);
  15.     }
  16.     console.log(Math.floor(totalGameDays));
  17. }
  18.  
  19. volleyball(["normal", 60, 0]);
Advertisement
Add Comment
Please, Sign In to add comment