Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Nov 7th, 2005, 5:37 AM   #11
2roll4life7
Programmer
 
2roll4life7's Avatar
 
Join Date: Aug 2005
Location: 0x0010 * 0x0091 + 0x0004
Posts: 65
Rep Power: 4 2roll4life7 is on a distinguished road
Quote:
Originally Posted by massive-war
is it?
You don't need to import String because the whole java.lang package is compiled in with it. If you don't believe me just throw a verbose flag in next time you compile
Quote:
C:> javac -verbose MyClass.java
__________________
#if 0 /* in case someone actually tries to compile this */
- libpng version 1.2.8 (example.c)

<Jim_McNeat> Is there like a way to put a compiler in "Just trust me on that one" mode?
2roll4life7 is offline   Reply With Quote
Old Nov 7th, 2005, 6:31 PM   #12
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Thanks!! the Monster Class is fixxed...

Next is the Room Class...

The addRoom(int) is reasonably simple. When addRoom(int) is called, it takes the value specified and stores it in the array intRooms[] at the location specified by intRoomCount. It then increases the pointer (intRoomCount) by one. Heres what i have so far..

public class Room

{

    int intRooms[];
    int intRoomCount = 0;

    
    
    
    public void addRoom(int NewRoom)
    {
        
        intRooms[intRoomCount] = NewRoom;
        ++intRoomCount;
        
    }

Ive tried compiling and testing but it say there is an error...
dangel55 is offline   Reply With Quote
Old Nov 7th, 2005, 10:42 PM   #13
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
What's the error ?
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Nov 8th, 2005, 2:46 AM   #14
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Null exception error
dangel55 is offline   Reply With Quote
Old Nov 8th, 2005, 3:11 AM   #15
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Try : intRoomCount ++;
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Nov 8th, 2005, 6:13 PM   #16
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Got the same error, here is more detail:

java.lang.NullPointerException

at Room.addRoom(Room.java:14)

at RoomTest.main(RoomTest.java:33)
dangel55 is offline   Reply With Quote
Old Nov 8th, 2005, 11:24 PM   #17
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
int intRooms[] = new int [20] ; // for example
I guess u could have a method that determines the number of rooms you want : int totalRooms = ??? ;
and then have : int intRooms[] = new int [totalRooms];
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Nov 9th, 2005, 9:59 PM   #18
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
SWEET! it works now...now i just have to figure out the rest of the code...

At this point its the interface: it just needs to consist of three Buttons and a Label. Each of the three Buttons will represent one room that the user can enter. The Label will tell the user what room they are in.

To set things up, we need two things – a pointer, to know where we are, and an array of type Room.

My question is how should i declare this array?


Here is my Room Layout : -

Room 0: 1, 4, 5
Room 1: 0, 2, 7
Room 2: 1, 3, 9
Room 3: 2, 4, 11
Room 4: 0, 3, 13
Room 5: 0, 6, 14
Room 6: 5, 7, 16
Room 7: 1, 6, 8
Room 8: 7, 9, 17
Room 9: 2, 8, 10
Room 10: 9, 11, 18
Room 11: 3, 10, 12
Room 12: 11, 13, 19
Room 13: 4, 12, 14
Room 14: 5, 13, 15
Room 15: 14, 16, 19
Room 16: 6, 15, 17
Room 17: 8, 16, 19
Room 18: 10, 17, 19
Room 19: 12, 15, 18
dangel55 is offline   Reply With Quote
Old Nov 9th, 2005, 11:03 PM   #19
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Use a matrix Room[20][3].
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Nov 9th, 2005, 11:34 PM   #20
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
I dont know how to use those, heheh thats a bit advanced for me...
dangel55 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




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

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