|
| | #1 (permalink) |
| Registered User Join Date: May 2006
Posts: 93
| java help Yes this is a homework question. This program makes a random point then the user inputs a guess to try and guess the point. The computer gives you hints as to which direction you should go (north south east west, north west, south west, etc.) I cant find a way to print out to the user which direction they should go. Ive made 4 strings based on the users guess and the real (computer generated) point that tell the user to go n, s, e, w. The only way I can see is to have about 16 lines under each hot, warm or cold hint telling the user every possible direction they should go. If anyone has an idea on how to do this I will be very thankful! This current code compiles. Using jdk 1.60 and jre 1.60. Code:
|
| | |
| | #2 (permalink) |
| So there's this plane on a treadmill... Join Date: Jan 2005 Location: Southern California
Posts: 2,935
+5 Internets | Not *quite* sure what your asking, but instead of having it display "your hot", have a variable temperature or whatever to store if their hot, warm or cold. Also, dont use strings for each direction, just make 1 direction string, and set it to whatever direction they need to go. Finally, do something like System.out.println( "Your " + temperature + "! Move " + direction); ? Edit: Also, to save even more typing, have it check north and south first, set the string equal to whichever, then seperatly check east and west, and have it append that choice, so you get a string that for instance will look like "north west" to avoid checking for all 8 directions. Last edited by Zuuljin : 02-08-2007 at 10:53 PM. |
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |