![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2005
Posts: 11
Rep Power: 0
![]() |
Hunt the Wumpus
Hey can someone help me...im doing a project trying to build the source code for this game...need help with the bulk of it....
i have 3 classes Monster, Room and the Wumpus Applet... The applet is ok just the monster and room are a problem...lets start with the Monster class... public class Monster { // String strDescription; int intLocation; String strEvent; public int getLocation() { return intLocation; } public void setLocation(int setNewLocation)// { intLocation = setNewLocation; } public String getDescription()// { return strDescription; } public void setDescription(String setNewDescription)//) { strDescription = setNewDescription; } public String getEvent() { return strEvent; } public void setEvent(String setNewEvent) { strEvent = setNewEvent; } private int checkRoom (int roomThreat); int threat = 0; boolean roomThreat = false; roomThreat = true; } } |
|
|
|
|
|
#2 |
|
Professional Programmer
|
So uh... what's your question?
|
|
|
|
|
|
#3 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
lol.. yeah, what's your question? And use code tags next time
Read the post for new users ![]() |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Illinois--> My room
Posts: 117
Rep Power: 0
![]() |
Did you import the string class to your monster class?
import java.lang.String;
__________________
Support Our Troops |
|
|
|
|
|
#5 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
String is imported by default, i believe.
|
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Illinois--> My room
Posts: 117
Rep Power: 0
![]() |
is it?
__________________
Support Our Troops |
|
|
|
|
|
#7 |
|
Professional Programmer
|
Yeah you don't need to import String..
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Nov 2005
Posts: 11
Rep Power: 0
![]() |
Basically checkRoom(int): boolean. This is the Method which will be used to determine if the room contains a threat. When called, the caller will need to specify a room number – such as “12”. If that is the same as the number stored in “intLocation”, the Method will return true – if not, it will return false.
private int checkRoom (int roomThreat);
int threat = 0;
boolean roomThreat = false;
roomThreat = true;Im just asking how to do this....my code is obviously wrong but i dont know how to fix it. |
|
|
|
|
|
#9 |
|
Newbie
Join Date: Nov 2005
Posts: 11
Rep Power: 0
![]() |
Thanks so much for replying guys....appriciate the help..
|
|
|
|
|
|
#10 |
|
Professional Programmer
|
private boolean checkRoom (int roomThreat){
return(intLocation == roomThreat);
}
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|