-
Class errors
I been trying to develop a class for the last few days and an error appears
whenever i try to compile the test file. I'm not sure what i have done wrong,
can you take a look at my code to see where i might have gone wrong. I am
not a genious at this so i would be very grateful if you could help me before
this Friday. Here's my code
This is the test file.....
public class SimpleSeatTest {
public static void main( String[] args ) {
SimpleSeat seat; // Seat object to test.
int row; // Row number of seat.
int pos; // Position in row of seat.
int status; // Seat status.
seat = new SimpleSeat(0,0);// Create a SimpleSeat object.
row = seat.getRow();
pos = seat.getPosition();
status = seat.getStatus();
System.out.println( "SimpleSeat: row=" + row +
" position=" + pos + " status=" + status );
seat.setStatus( 1 );
System.out.println( "SimpleSeat status changed:" );
status = seat.getStatus();
System.out.println( "Seat status=" + status );
}
}
and this is the class i developed....
class SimpleSeat {
private int[] row; //initialsing instance variables
private int[] pos;
private int status
public SimpleSeat (int x, int y) { //construtor
row = x;
pos = y;
}
public int getRow() { //methods
return row;
}
public int getPosition() {
return pos;
}
public int getStatus() {
return status;
}
public void setStatus(int newStatus) {
status = newStatus;
}
}
Yours sincerely
Jenny
-
Re: Class errors
class SimpleSeat {
private int row; //initialsing instance variables
private int pos;
private int status;
public SimpleSeat (int x, int y) { //construtor
row = x;
pos = y;
}
public int getRow() { //methods
return row;
}
public int getPosition() {
return pos;
}
public int getStatus() {
return status;
}
public void setStatus(int newStatus) {
status = newStatus;
}
}
modify ur class as above
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks