Results 1 to 13 of 13
- 03-28-2011, 02:40 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
-
Please tell us how you are confused and what specific questions you have. Show us your code, and ask a detailed question to get a helpful answer.
- 03-28-2011, 03:20 AM #3
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
Create an ArrayList of the Integer type. Then use an infinite loop:
to ask for input using a Scanner object until the user notifies that he is done entering numbers. For each number entered, add this number to your ArrayList.Java Code:for(; ;){}
Finally, use the ArrayList methods found in the Java API to get the first and last numbers.
- 03-28-2011, 03:38 AM #4
If the only objective is to display the first and last number then storing all the numbers in between is pointless. Just use 2 variables and a boolean to determine if/when to store the first value.
- 03-28-2011, 04:06 AM #5
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
- 03-28-2011, 04:17 AM #6
Senior Member
- Join Date
- Feb 2011
- Location
- Georgia, USA
- Posts
- 122
- Rep Power
- 0
-
- 03-28-2011, 04:23 AM #8
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
- 03-28-2011, 04:26 AM #9
Senior Member
- Join Date
- Feb 2011
- Location
- Georgia, USA
- Posts
- 122
- Rep Power
- 0
- 03-28-2011, 08:05 PM #10
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
problem is to write a program to print the first and last number from the list using keyboard and While-Loop
the list contains 5,6,-2,-10,100,-7
the output should be 5 and -7
- 03-28-2011, 08:07 PM #11
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
- 03-28-2011, 08:56 PM #12
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
- 03-28-2011, 09:30 PM #13
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
I have posted a code in your last thread.Didn't you see that??
to print first and last number from a set of input numbers
i need help with a program
the output should be the first and last number from a set of number that you input. i am confused.
can anybody help me? i appreciated!
Regards,Java Code:<Mod edit: deleted>
UjjalLast edited by Fubarable; 03-29-2011 at 01:55 AM.
Similar Threads
-
Program - Print row of 5 even numbers, 5 rows, last num 50
By An Alien in forum New To JavaReplies: 10Last Post: 12-20-2010, 12:47 PM -
using backtracking to print all possible orders of numbers
By yotamoo in forum New To JavaReplies: 6Last Post: 12-08-2010, 12:39 AM -
how to multiply numbers in rows and print it next to it
By racewithferrari in forum New To JavaReplies: 1Last Post: 01-16-2010, 06:24 PM -
printing number of pos/neg numbers input?
By shroomiin in forum New To JavaReplies: 12Last Post: 09-25-2009, 02:15 AM -
Prime Number - System print all the prime numbers ...
By pinkdreammsss in forum New To JavaReplies: 20Last Post: 04-26-2009, 01:50 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks