Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   simple problem - code wont compile (http://www.programmingforums.org/showthread.php?t=14538)

dirtycash Nov 20th, 2007 9:54 AM

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.

Arla Nov 20th, 2007 10:32 AM

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?

DaWei Nov 20th, 2007 10:50 AM

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. ;)

mrynit Nov 20th, 2007 2:06 PM

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.

null_ptr0 Nov 21st, 2007 8:50 PM

Re: simple problem - code wont compile
 
SIGH.
Please read the java tutorials before you proceed.


All times are GMT -5. The time now is 1:17 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC