6G Celicas Forums

Welcome Guest ( Log In | Register )

> 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
 
Start new topic
Replies
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: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

Posts in this topic
- Celicaca   anyone know Java   Feb 13, 2006 - 10:56 PM
- - Jaws4God   I did some java in college.... might can help.. id...   Feb 13, 2006 - 11:07 PM
- - Coomer   I know some Java. Basically, you could use java.ut...   Feb 13, 2006 - 11:11 PM
|- - Celicaca   QUOTE(Coomer @ Feb 14, 2006 - 4:11 A...   Feb 14, 2006 - 12:54 AM
- - Batman722   I know Jawa   Feb 14, 2006 - 12:12 AM
- - bloodrain   i always wanted to get back into programming. I mi...   Feb 14, 2006 - 9:29 AM


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: July 8th, 2025 - 4:50 AM