The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

System.out.println problem

I'm new to this and trying to teach myself (I'm only 13). So I wrote this code and have everything working except, I want it too display "number out of range, try again" message only when you enter a number higher than 100. Right now it displays "Too high, try again" and "number out of range, try again". How do i change it to display "number out of range, try again" only? Also how do i get to display "Guess a number between 1 and 100" only once and not every time you try and guess the number. Any help will be greatly appreciated.

Re: Some Quick Help PLZ

() Typing words like "Quick" or "Urgent" does not make me decide to check the forum any sooner, wastes readers' time, and causes people to not read your post. So probably not a good title to get help with a problem.

()

I'm new to this and trying to teach myself

:-) That is the fun way

()Please put [code=java] before your code and [/code] after your code to make it all colorful for old eyes to read it.

()Your questions suggest you skipped the first steps of problem solving. I like to get a clear understanding of the problem I am to solve in code. Then come up with a way to solve that problem.
In your case you want to get a number from the user until the guess is correct. That would make one big loop. Inside that loop you have other tasks to do. The things you want to see only when the user makes a guess will be inside that loop.
The important thing to see here is how your solution-on-paper will later translate into code that produces a loop to do some tasks, but not others. Then you will already know where to place things in your code before you write the code.
Best advice I can think of, get a well organized plan before writing any code.

Re: Some Quick Help PLZ

Ok, so i did a little flowchart this morning and figured out my problem for Guess a number and enter a number. I'm suck on the out of range for numbers. I'm going to do some reading but if you can point me in the right direction that would be great. Also, sorry about the thread title it was late and i was getting a little frustrated with myself.