Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public void doSearch() {
  2. int daysWanted = UI.askInt("Number of days required");
  3. int count = 0;
  4. int day = 0;
  5. int unit = 0;
  6. boolean found = false;
  7. for(int i = 0; i < numUnits; i++){
  8. for(int n = 0; n < numDays; n++){
  9. if(bookings[i][n] == null){
  10. count++;
  11. }
  12. else if(bookings[i][n] != null){
  13. count = 0;
  14. }
  15. if(count == daysWanted){
  16. unit = i;
  17. day = n;
  18. while(count != 0){
  19. this.displayCell(unit, day, Color.red);
  20. count--;
  21. day--;
  22. }
  23. found = true;
  24. this.redisplay();
  25. break;
  26. }
  27. }
  28. if(found == true){
  29. break;
  30. }
  31. count = 0;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement