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: -
SeatAssign.java:54: setSeats(char[][]) in SeatAssign cannot be applied to (char[][],int,int)
-
setSeats (Seats, row, col);
-
^
-
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. -
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
-
-
3 5630
You defined "public static void setSeats (char Seats[][]);" that initialized all the Seats, I think you need to create a new function called setSeat maybe that takes in a row and column and sets only that one row/column Seat value.
Max
Thank you, I'll give that a try and post any problems I might have :)
@Slick47
You should've read the error message, it tells it all: -
setSeats(char[][]) in SeatAssign cannot be applied to (char[][],int,int)
-
Your compiler is trying to tell you that it found a method setSeats(char[][]) but you are trying to call it with an incompatible parameter list (char[][], int, int). That should've rang a bell. Always first read the compiler's error and/or warning messages and try to understand what it's trying to tell you.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul Rubin |
last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd
like to use an assignment expression, like
for line in file:
if (g := re.match(pat, line)):
croggle(g.group(1))
Since...
|
by: Chad |
last post by:
I'm in an intro to VB.net class. I'm haveing trouble with this
assignment, if anyone could help me please let me know. thanks!
Coding Assignment 7-Chapter 8 OOP-CSCI-171 Intro to VB.NET
...
|
by: Chris |
last post by:
Is there ever a reason to declare this as
if(*this == rhs)
as opposed to what I normally see
if(this == &rhs)
?
|
by: 1051109210 |
last post by:
im suppose to do a "airplane sitting" program
1 a b c d
2 a b c d
3 a b c d
(till 7)
den if i ask a user to type in their seats...
1 a b x d
|
by: john |
last post by:
Hey,
I know we use the pointer this to obtain a class object or class
member data. I don't follow the reason for example this code. I'am
quite confused
assingment operator
const B...
|
by: thesti |
last post by:
hi,
i'm asked to create a program in which there's a component like this
http://jakkos.110mb.com/images/component.JPG
it's like a seat reservation program. in which we are able to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |