Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void doSearch() {
- int daysWanted = UI.askInt("Number of days required");
- int count = 0;
- int day = 0;
- int unit = 0;
- boolean found = false;
- for(int i = 0; i < numUnits; i++){
- for(int n = 0; n < numDays; n++){
- if(bookings[i][n] == null){
- count++;
- }
- else if(bookings[i][n] != null){
- count = 0;
- }
- if(count == daysWanted){
- unit = i;
- day = n;
- while(count != 0){
- this.displayCell(unit, day, Color.red);
- count--;
- day--;
- }
- found = true;
- this.redisplay();
- break;
- }
- }
- if(found == true){
- break;
- }
- count = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement