jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Stacks Need Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stacks Need Help" Watch "Stacks Need Help" New topic
Author

Stacks Need Help

Alan Green
Greenhorn

Joined: Sep 07, 2003
Posts: 17
Say if i have created two different stacks,and any integer over 10 goes in one stack(bigStack). If less than 10 goes in one stack(theStack). The program is already working where it will resize if its full,but I am trying to put the integers in the right Stack. This is what I have so far.


[ Jess added UBB [code] tags to preserve whitespace, check 'em out! ]
[ September 23, 2003: Message edited by: Jessica Sant ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Hi Joe,
I find it really hard to believe that you could understand the program above, but still need to ask this question. It's important to take the time to read and understand code the code you're working with; you're not going to learn anything otherwise.
That said, in a loop near the end of the program, you're reading each line, parseInt()-ing it, and pushing it onto a stack. All you need to do is use an "if" statement to choose between the two stacks -- i.e., "if (next < 10) ... else ..."
[ September 22, 2003: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stacks Need Help