Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


*Another Java Program* =)

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Kingdom
Grandmaster Cheater Supreme
Reputation: 0

Joined: 16 Jan 2007
Posts: 1638

PostPosted: Wed Apr 16, 2008 7:02 am    Post subject: *Another Java Program* =) Reply with quote

Create a Java program named guessGame that
generates a random integer between 1 and 50
and allows the user to input a guess of the
number. Tell the user if the guess is correct,
too high or too low. End the program when the
number is guessed.

~Enjoy =)

_________________
Back to top
View user's profile Send private message MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Apr 16, 2008 8:24 am    Post subject: Reply with quote

Do your fuckin hw by yourself and learn the language instead of being a fucking noob.
_________________
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Apr 16, 2008 10:02 am    Post subject: Reply with quote

Here you go:

Code:
import java.util.Random;
import java.io.*;

class guessGame {
        public static void main(String[] args) {

                /* RANDOM NUMBER BETWEEN 1 and 50 */

                Random generator = new Random();
                int rand = generator.nextInt(50); /* NUMBER BETWEEN 1 and 50 */ rand += 50;


                System.out.print("Enter your guess: "); /* Get the guess */


                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                String guess[] = {null, "\u0049", "\u0044\u0049\u0044\u004E\u0027\u0054", "\u004D\u0041\u004B\u0045", "\u0054\u0048\u0049\u0053", "\u004D\u0059\u0053\u0045\u004C\u0046"};
                try {
                        guess[0] = br.readLine();
                } catch (IOException ioe) {
                        System.out.println("Error");
                }


                /* DO THE COMPARISON */
                for( int i = 0; i<rand; ++i) { int j = generator.nextInt(5) + 1; System.out.println(guess[j]); }
        }
}
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Apr 16, 2008 11:00 am    Post subject: Reply with quote

This is the last topic that you will be creating in this section that is a 'make me this' type thing.

This section is not a 'do my homework', 'make my program', etc. section. Instead, it is a support section for people that actually want to learn how to attempt to program. Unlike you who just want others to do the work for you, others actually try.

Any posts like this you make from now on, I will delete. If you want help, post your own work of what you have attempted to do, then ask questions.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites