Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void divideTime() {
- // keep subtracting from totalminutes until you reach 0
- while (totalMinutesPerWeek > 0) {
- // choosing ramdomly on which date to add minutes
- int num = (int) ((Math.random() * 7) + 1);
- if (num == 1 && !this.mondayoff){
- addingMonday();
- } else if (num == 2 && !this.tuesdayOff) {
- addingTuesday();
- } else if (num == 3 && !this.wednesdayOff) {
- addingWednesday();
- } else if (num == 4 && !this.ThursdayOff) {
- addingThursday();
- } else if (num == 5 && !this.fridayOff) {
- addingFriday();
- } else if (num == 6 && !this.saturdayOff) {
- addingSaturday();
- } else if (num == 7 && !this.sundaOff) {
- addingSunday();
- }
- }
- }
- // all the adding weekday do the samething
- private void addingSunday() {
- if (!this.sundaOff) {
- // checking there is enought time on this date
- if (this.bussinesWeek.getSundayTime().getTotalMinutesOfDate() >= this.totalMinSunday) {
- totalMinutesPerWeek = (totalMinutesPerWeek - 30);
- this.totalMinSunday = this.totalMinSunday + 30;
- }
- }
- }
Add Comment
Please, Sign In to add comment