java - The primitive type int of FC_COLS does not have a field inBlockSize -
i getting error on laststartcol = fc_cols – inblocksize;
, similar error laststartcol = economy_cols – inblocksize;
. not sure teacher wants me statement.simple answers appreciated.
//determine laststartcol, last legal start column given block //size in row.
if(inrow < fc_rows) laststartcol = fc_cols – inblocksize; else laststartcol = economy_cols – inblocksize; for(int startcol = 0; startcol <= laststartcol; startcol++) { ...
whole class:
public class airplane { private seat [ ] [ ] seats; public static final int first_class = 1; public static final int economy = 2; private static final int fc_rows = 5; private static final int fc_cols = 4; private static final int economy_rows = 5; private static final int economy_cols = 6; public airplane() { seats = new seat[fc_rows][fc_cols]; (int i=0; i<fc_rows; i++) { (int j=0; j<fc_cols; j++) { seats[i][j] = new seat(seat.window); } seats = new seat[economy_rows][economy_cols]; (int x=0; x<economy_rows; x++) { (int y=0; y<economy_cols; y++) { seats[x][y] = new seat(seat.window); } } } } public string tostring() { string str = ""; (int i=0; i<fc_rows; i++) { (int j=0; j<fc_cols; j++) { str= str + seats[i][j].tostring(); } str = str + "\n"; } return str; } public string tostring2() { string z = ""; (int x=0; x<economy_rows; x++) { (int y=0; y<economy_cols; y++) { z= z + seats[x][y].tostring(); } z = z + "\n"; } return z; } private int findemptyblockinrow(int inrow, int inblocksize, int inseattype) { int laststartcol; //determine laststartcol, last legal start column given block //size in row. if(inrow < fc_rows) laststartcol = fc_cols – inblocksize; else laststartcol = economy_cols – inblocksize; for(int startcol = 0; startcol <= laststartcol; startcol++) { ... //starting @ startcol, check inblocksize consecutive seats //that empty , include seat type looking for. if //a seat block found, return startcol. for(int = 0; < inblocksize; i++) { if (seats[inrow][startcol + i].isavailable()==true) { int f = 0; f++; } if (seats[inrow][startcol + i].getseattype() == inseattype) { int d = inseattype; } return laststartcol; } } } }
my understanding mistake typing.
try in line laststartcol = fc_cols - inblocksize;
first remove -
, again enter minus symbol keyboard.
do above line laststartcol = economy_cols - inblocksize;
or
try replace line of code below.
if(inrow < fc_rows) laststartcol = fc_cols - inblocksize; else laststartcol = economy_cols - inblocksize;
Comments
Post a Comment