![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2007
Posts: 2
Rep Power: 0
![]() |
simple problem - code wont compile
public class Hotel {
public static final int ROOM_PRICE = 20;
public static final int SEAVIEW_SUPPLEMENT = 5;
public static final int SINGLE_OCCUPIER_SUPPLEMENT = 5;
public static final int DINNER_PRICE = 9;
//declaring
private Room[] array1;
//An integer value representing the amount of money the hotel taken.
private int hotelMoney = 0;
//declaring
private static int freeRooms=number of rooms available in the hotel;
//An integer value indicating the amount of free rooms available.
public void freeRooms()
{
freeRooms=freeRooms-1;
}
}it says a ";" is expected and highlights the following: private static int freeRooms=number of rooms available in the hotel; any help would be appreciated. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 142
Rep Power: 4
![]() |
Re: simple problem - code wont compile
My knowledge of Java is somewhat minimal, but you are trying to assign a value of "number of free rooms available in the hotel" to an int?
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: simple problem - code wont compile
Yeah, I think your assignment expected you to replace "number of free rooms available in the hotel" with an actual number.
![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
Re: simple problem - code wont compile
youn need to read the java syntax for variable assignment. you cant have a bunch of english word after an equals sign for assignment. the compiler doesnt know what those words mean. it only knows keywords and varibles you tell it use.
__________________
i dont know much about programming but i try to help |
|
|
|
|
|
#5 |
|
11 years old
Join Date: Nov 2007
Posts: 79
Rep Power: 1
![]() |
Re: simple problem - code wont compile
SIGH.
Please read the java tutorials before you proceed. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to compile C++ code in GNU/Linux OS ? | verb1426 | C++ | 5 | Feb 26th, 2006 12:19 PM |
| Problem with code - system null ref error | absentmindedjwc | C# | 4 | Feb 17th, 2006 12:50 PM |
| Problem with porting of Linux code to Windows, FORTRAN/C. | stormlab | C | 1 | Oct 15th, 2005 10:18 PM |
| Simple file reading problem | Jessehk | C++ | 4 | Aug 10th, 2005 1:24 PM |
| Notepad Code Problem | Planet_EN | C | 2 | Jun 19th, 2005 7:30 PM |