Willoferd
Dec 4th 2006, 9:32 pm
Any help would be very grateful. I don't know how to do this part or what they are asking me to do.
1. In the body of your HTML file, use the h1 tag to place the header, "Airline Reservation System".
2. Make a call to the function setUpArray(). Now is the time to fill in the code for the definition of this function in the head. The setUpArray() function will create an array of size 6. Each entry in this array will be itself an array of size 4, so as a result you will create a 2-dimensional array (matrix) of size 6 x 4. This will be your representation of the seats in the plane. An entry at row i, column j will correspond to the seat at row i, column j in the plane. In order to create the array of size 6, use the statement:
seat = new Array(6);
In this way, seat will become the name of your array. Now, you need to assign to each entry of the seat array, an array of size 4. To make your code short, do this by using a counter-controlled loop. After your 6 x 4 matrix is created, you need to initialize all of its 24 entries to the empty string (“”). To do this, you will need a doubly-nested counter-controlled loop. The outer loop will be counting through the row indices and the inner loop will be counting through the column indices. If the loop is currently at row i, column j, the statement, seat[i][j]=””, will initialize the seat at row i, column j to the empty string. Thus, all seats in the plane will be initially free. When later elsewhere in your code you want to assign a person to a specific seat, you will replace the empty string in the corresponding entry in your matrix with a string consisting of the name of that person.
Please my project is due in 2 days and this is the part I am stuck on.
Thanks,
AJ
1. In the body of your HTML file, use the h1 tag to place the header, "Airline Reservation System".
2. Make a call to the function setUpArray(). Now is the time to fill in the code for the definition of this function in the head. The setUpArray() function will create an array of size 6. Each entry in this array will be itself an array of size 4, so as a result you will create a 2-dimensional array (matrix) of size 6 x 4. This will be your representation of the seats in the plane. An entry at row i, column j will correspond to the seat at row i, column j in the plane. In order to create the array of size 6, use the statement:
seat = new Array(6);
In this way, seat will become the name of your array. Now, you need to assign to each entry of the seat array, an array of size 4. To make your code short, do this by using a counter-controlled loop. After your 6 x 4 matrix is created, you need to initialize all of its 24 entries to the empty string (“”). To do this, you will need a doubly-nested counter-controlled loop. The outer loop will be counting through the row indices and the inner loop will be counting through the column indices. If the loop is currently at row i, column j, the statement, seat[i][j]=””, will initialize the seat at row i, column j to the empty string. Thus, all seats in the plane will be initially free. When later elsewhere in your code you want to assign a person to a specific seat, you will replace the empty string in the corresponding entry in your matrix with a string consisting of the name of that person.
Please my project is due in 2 days and this is the part I am stuck on.
Thanks,
AJ