Advertisement
vborislavova

10. Volleyball - Conditional Statements Advanced

Feb 24th, 2020
122
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 p = Number(input.shift());
  4.         let h = Number(input.shift());
  5.            
  6.         let playedDays = 0.00;
  7.         let weekendsInSofia = 48 - h;
  8.         let weekendsInKaspichan = h;
  9.  
  10.         if ( year == "leap") {      
  11.           playedDays = ((weekendsInSofia * 0.75) + h + (p * 2/3));
  12.           playedDays = Math.floor(1.15 * playedDays);
  13.           console.log("{ }", playedDays);      
  14.         } else if (year == "normal") {
  15.           playedDays = Math.floor((weekendsInSofia * 0.75) + h + (p * 2 / 3));
  16.           console.log("{ }", playedDays);
  17.         }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement