Hey guys, I've gone one problem (so far) in my program to be able to assign and display seats. When I compile my program I get the error:
I have marked this line with some asterisks and was hoping we could deliberate on what the problem with it is? Thanks guys in advance.
Code:
SeatAssign.java:54: setSeats(char[][]) in SeatAssign cannot be applied to (char[][],int,int) setSeats (Seats, row, col); ^
Code:
import javax.swing.*;
import java.text.*;
import java.util.*;
class SeatAssign{
final static int ROWS = 14;
final static int COLS = 7;
//MAIN MAIN MAIN MAIN
public static void main (String[] args){
char[][] Seats;
char seat;
int opt;
Seats = new char[ROWS][COLS];
Scanner scanner;
scanner = new Scanner(System.in);
setSeats(Seats);
System.out.println("Welcome to Seat Selector Pro! The realistic seat selection program!");
do{
System.out.println();
System.out.println("Please select an option:\n 0:Exit \n 1:Display Seats \n 2:Book a seat");//choose opt area
opt = scanner.nextInt();
if (opt == 0)
return;
else if (opt == 1)
DisplaySeats(Seats); //call up the DisplaySeats function
else if (opt == 2){
int row, col;
char seatseat;
System.out.print("Please enter a row number <1-13>:");
row = scanner.nextInt();
System.out.print("Please enter a column number <1-6>:");
col = scanner.nextInt();
*************seatseat = getSeat (Seats, row, col);*************
if (seatseat == 'o'){
setSeats (Seats, row, col);
DisplaySeats (Seats);
}
else
System.out.println("Seat is occupied.");
//call up the setSeats function
setSeats(Seats);
}
else
System.out.println("Error in number selection, only enter 0, 1, or 2.");
} while(opt != 0);
/*
Seats[4][3] = 'x';
seat = getSeat(Seats, 4, 3);
if (seat == 'x') //occupied
System.out.println("seat[4][3] is occupied " + seat);
*/
}
//MAIN MAIN MAIN MAIN
//setSeats setSeats setSeats setSeats
public static void setSeats (char Seats[][]){
int row, col;
for (row = 1; row < ROWS; row++)
for (col = 1; col < COLS; col++)
Seats[row][col] = 'o';
}
//setSeats setSeats setSeats setSeats
//DISPLAY SEATS DISPLAY SEATS DISPLAY SEATS
public static void DisplaySeats(char Seats[][]){
int row, col, colnum;
//Numbers for the columns
System.out.print(" ");
for (colnum = 1; colnum < 7; colnum++){
System.out.format(" %1d" , colnum);
}
System.out.println();
//Numbers for the columns
for (row = 1; row < ROWS; row++){
System.out.format("%2d", row);
for (col = 0; col < COLS; col++)
System.out.print(Seats[row][col] + " ");
System.out.println();
}//for row
}
//DISPLAY SEATS DISPLAY SEATS DISPLAY SEATS
//getSeats getSeats getSeats getSeats getSeats
public static char getSeat(char Seats[][], int r, int c){
return Seats[r][c];
//maybe a scanner funciton in here?
}
//getSeats getSeats getSeats getSeats getSeats
}//END
Comment