Guest User

Untitled

a guest
Mar 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public void divideTime() {
  2. // keep subtracting from totalminutes until you reach 0
  3. while (totalMinutesPerWeek > 0) {
  4. // choosing ramdomly on which date to add minutes
  5. int num = (int) ((Math.random() * 7) + 1);
  6.  
  7. if (num == 1 && !this.mondayoff){
  8. addingMonday();
  9. } else if (num == 2 && !this.tuesdayOff) {
  10. addingTuesday();
  11. } else if (num == 3 && !this.wednesdayOff) {
  12. addingWednesday();
  13. } else if (num == 4 && !this.ThursdayOff) {
  14. addingThursday();
  15. } else if (num == 5 && !this.fridayOff) {
  16. addingFriday();
  17. } else if (num == 6 && !this.saturdayOff) {
  18. addingSaturday();
  19. } else if (num == 7 && !this.sundaOff) {
  20. addingSunday();
  21. }
  22. }
  23.  
  24. }
  25. // all the adding weekday do the samething
  26. private void addingSunday() {
  27. if (!this.sundaOff) {
  28. // checking there is enought time on this date
  29. if (this.bussinesWeek.getSundayTime().getTotalMinutesOfDate() >= this.totalMinSunday) {
  30. totalMinutesPerWeek = (totalMinutesPerWeek - 30);
  31. this.totalMinSunday = this.totalMinSunday + 30;
  32.  
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment