Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: finding the most repeated name in a stack

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default finding the most repeated name in a stack

    I am new to programming, so please accept my apologies if this question is simple.

    My teacher wants us to create a method that searches a stack for the name that occurs most often and returns it

    for example : If I have these names in my stack:

    Tiger Woods, Jack Nicholas, Arnold Palmer, Jack Nicholas, Jimmy Demerrit, Jack Nicholas, Sam Sneed, Jimmy Demerrit, Ben Hogan, Walter Hagen, Tommy Armor, Bobby Jones

    the method should return Jack Nicholas

    Please help me for I need to know how to do it for my program

    thank you in advance


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: finding the most repeated name in a stack

    Welcome to Java Programming Forums. Try to read the forums Rules.
    How will you solve this problem if you try to do it manually? Take a copy and pencil, draw a stack with the above data and try doing how you will reach the solution. Write all the steps and then program those steps. If you stuck in some kind of error in your program, you can ask here.

  3. #3
    Member
    Join Date
    Dec 2011
    Location
    United States
    Posts
    94
    My Mood
    Amused
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Default Re: finding the most repeated name in a stack

    Try this out if you get stuck:
    Java Platform SE 7

Similar Threads

  1. Replies: 0
    Last Post: July 27th, 2011, 10:31 AM
  2. stack
    By ridg18 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 22nd, 2011, 12:45 PM
  3. Stack
    By AmyH in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 7th, 2010, 04:04 PM
  4. GuessWhat- same errors repeated 4 times?
    By iank in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 5th, 2009, 08:32 PM
  5. Error of "cannot access InToPost" in 3 and 5 code
    By jaysoncutie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 25th, 2009, 09:12 AM

Tags for this Thread