Results 1 to 4 of 4
Thread: number comparisson help
- 05-01-2008, 07:39 AM #1
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
number comparisson help
I've been working on this for a while and can't get it to work. Basically it's a program that stores sale amounts into an array. Then asks the user to enter an amount, then prints the sales people who exceeded the amount. Here is my for loop.
public void salesCompare()
{
for (int i=0; numCompare < this.sales[i]; i++)
{
System.out.println(this.sales[i]);
}
}//salesCompare()
numCompare is the user entered number and sales[] is obviously my array. When I run it, nothing happens. Any suggestions?
- 05-01-2008, 08:01 AM #2
probably your numCompare is larger than sales[i];
My IP address is 127.0.0.1
- 05-01-2008, 08:25 AM #3
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
Nope.
I've been testing it with easy numbers. To test it I set sales[]=5.
sales[0]=1
sales[1]=2
.
.
.
sales[4]=5
numCompare=2
yet nothing prints
- 05-01-2008, 08:31 AM #4
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
how to use Scanner with a number
By cew27 in forum New To JavaReplies: 10Last Post: 04-03-2009, 06:23 PM -
line number
By kazitula in forum New To JavaReplies: 3Last Post: 11-21-2007, 10:27 PM -
How to get next available number from MS access
By shahjehan in forum JDBCReplies: 3Last Post: 11-18-2007, 07:41 PM -
how to know the number of bytes
By gabriel in forum New To JavaReplies: 2Last Post: 08-06-2007, 05:13 PM -
how to know the number of the line
By simon in forum New To JavaReplies: 3Last Post: 08-01-2007, 04:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks