Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 20th, 2007, 9:54 AM   #1
dirtycash
Newbie
 
Join Date: Nov 2007
Posts: 2
Rep Power: 0 dirtycash is on a distinguished road
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.
dirtycash is offline   Reply With Quote
Old Nov 20th, 2007, 10:32 AM   #2
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 142
Rep Power: 4 Arla is on a distinguished road
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?
Arla is offline   Reply With Quote
Old Nov 20th, 2007, 10:50 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Nov 20th, 2007, 2:06 PM   #4
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: olympia,WA
Posts: 332
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
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
mrynit is offline   Reply With Quote
Old Nov 21st, 2007, 8:50 PM   #5
null_ptr0
11 years old
 
Join Date: Nov 2007
Posts: 79
Rep Power: 1 null_ptr0 is on a distinguished road
Re: simple problem - code wont compile

SIGH.
Please read the java tutorials before you proceed.
null_ptr0 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:40 AM.

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