6G Celicas Forums

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> anyone know Java
post Feb 13, 2006 - 10:56 PM
+Quote Post
Celicaca

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
post Feb 13, 2006 - 11:07 PM
+Quote Post
Jaws4God



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
post Feb 13, 2006 - 11:11 PM
+Quote Post
Coomer



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. smile.gif


--------------------
New Toyota project coming soon...
post Feb 14, 2006 - 12:12 AM
+Quote Post
Batman722



Enthusiast
*****
Joined Mar 8, '04
From Newport, RI
Currently Offline

Reputation: 63 (99%)




I know Jawa

user posted image


--------------------
post Feb 14, 2006 - 12:54 AM
+Quote Post
Celicaca

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. smile.gif


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
post Feb 14, 2006 - 9:29 AM
+Quote Post
bloodrain

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....
user posted image

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: January 10th, 2025 - 11:14 AM