forked from wevertor/AirTicketManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEconomyClass.java
37 lines (33 loc) · 957 Bytes
/
EconomyClass.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.*;
public class EconomyClass extends Class{
EconomyClass(){
sitMap = new int[15][];
for(int i=0; i<15; i++){
sitMap[i] = new int[6];
}
}
/* if sitIsEmpty == true, then add Passenger in hashmap */
boolean sitIsEmpty( /*int[][] sits,*/ int x, int y){
if((x>=5 && x<=19)&&(y>=0 && y<=5)){ //if the position exists
if(sitMap[x][y] == 0){ //if the sit is empty
return true;
}
}
return false;
}
void print(){
System.out.println(" A B C D E F");
for(int i = 0; i<15;i++){
if(i+1<10){
System.out.printf("0%d ", i+1);
}
else{
System.out.printf("%d ", i+1);
}
for(int j = 0; j<6 ;j++){
System.out.printf("%d ", sitMap[i][j]);
}
System.out.printf("\n");
}
}
}