anyone know Java |
anyone know Java |
Feb 13, 2006 - 10:56 PM |
|
Enthusiast Joined Feb 3, '04 From North Carolina Currently Offline Reputation: 0 (0%) |
I am new to java and wanted to figure out an example we did in class but i cant do it. i was wondering if anyone could point me in the right direction. it's a really simple program...i just cant figure out how to do it lol cause im new.
i want the program to ask the user to enter 2 integers. and then print out all the integers between the 2 numbers. thats all. i know i need a while statement and some kind of counter, but i dont know how to do it. if anyone can even show me the simple prog maybe i could just study it and learn. ty |
Feb 13, 2006 - 11:07 PM |
|
Enthusiast Joined Mar 27, '04 Currently Offline Reputation: 14 (100%) |
I did some java in college.... might can help.. idk
-------------------- ~Daniel~ No Longer Celica Owner.. moved on to a 03 WRX-EJ207
|
Feb 13, 2006 - 11:11 PM |
|
Administrator Joined Aug 23, '02 From Seattle, WA Currently Offline Reputation: 14 (100%) |
I know some Java. Basically, you could use java.util.Scanner's nextInt() function for accepting user input.
Then to print out all of the integers between the two numbers, you could do something like this: 1. Determine the smaller number(or if they're the same, in which case you'd output a message saying so.) 2. Increment your smaller number by one(So you don't include the user's entered number in your output.) 3. While the smaller number is less than the larger, print the smaller number and increment the smaller number by one. That's basically all you need to do. Shouldn't be too hard. -------------------- New Toyota project coming soon...
|
Feb 14, 2006 - 12:12 AM |
|
Enthusiast Joined Mar 8, '04 From Newport, RI Currently Offline Reputation: 63 (99%) |
I know Jawa
-------------------- |
Feb 14, 2006 - 12:54 AM |
|
Enthusiast Joined Feb 3, '04 From North Carolina Currently Offline Reputation: 0 (0%) |
QUOTE(Coomer @ Feb 14, 2006 - 4:11 AM) [snapback]393470[/snapback] I know some Java. Basically, you could use java.util.Scanner's nextInt() function for accepting user input. Then to print out all of the integers between the two numbers, you could do something like this: 1. Determine the smaller number(or if they're the same, in which case you'd output a message saying so.) 2. Increment your smaller number by one(So you don't include the user's entered number in your output.) 3. While the smaller number is less than the larger, print the smaller number and increment the smaller number by one. That's basically all you need to do. Shouldn't be too hard. yea i know what to do basically, i just cantactually do it lol but yea, ill keep trying. thankey This post has been edited by Celicaca: Feb 14, 2006 - 12:55 AM |
Feb 14, 2006 - 9:29 AM |
|
Enthusiast Joined Mar 3, '05 From Hollywood, FL Currently Offline Reputation: 0 (0%) |
i always wanted to get back into programming. I miss C++ and Java.
-------------------- To live, is to suffer
To survive, thats to find meaning, in the suffering.... |
Lo-Fi Version | Time is now: January 10th, 2025 - 4:03 PM |