SKGreyHound

National Court JS

Jul 4th, 2020
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function nationalCourt(emp1, emp2, emp3, pplCount) {
  2.  
  3. let pplServed = pplCount;
  4. let timeNeeded = 0;
  5. let restCounter = 0;
  6. let i = 3;
  7.  
  8. while (pplServed > 0) {
  9. pplServed -= emp1;
  10. pplServed -= emp2;
  11. pplServed -= emp3;
  12. timeNeeded++;
  13. restCounter++;
  14. if (restCounter % 10 === i) {
  15. timeNeeded++;
  16. i += 3;
  17. }
  18. }
  19. console.log(`Time needed: ${timeNeeded}.`);
  20.  
  21. }
RAW Paste Data