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 2 of 2

Thread: array problem that i need help with

  1. #1
    Member
    Join Date
    Oct 2011
    Posts
    35
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default array problem that i need help with

    The midville Park District maintains five soccer teams as shown in the table. Design a program that accepts a player's team name. Modify the Midville Park District program so that after the last player has been entered the program displays a count of the number of players registered for each team.

    Team Number Team Name

    1 Goal Getters

    2 The Force

    3 Top Guns

    4 Shooting Stars

    5 Midfield Monsters


    ok so i am not sure how to put this into array form meaning is it Team Name that becomes an array or team number. Can someone do this problem so that i can see how it is done.This is what i have so far but i dont know if it it right.
    Start
    Declarations
    num Team_number
    string Team_name[5]=Goal Getters,The Force,Top Guns,Shooting Stars,Midfield Monsters
    string quit=QUIT

    display “enter team number”
    input Team_number
    While Team_number not quit
    Team_name[Team_number]=Team_number +1
    Display “enter Team_number
    end while


    I am stuck after this point i dont know what to doooo!!!!!!!!! next or if i have to start over can someone write this so that i can get an idea of how it would be done.PLEASE!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: array problem that i need help with

    I think you're going about this the wrong way. Your array will have five indexes, 0-4. Index 0 holds the count for the first team, index 4 holds the count for the last team. Increment the value at the appropriate index as names are entered. Then loop through and print them out.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. 2D ARRAY PROBLEM
    By av8 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 27th, 2011, 07:20 PM
  2. Replies: 2
    Last Post: May 13th, 2011, 03:08 AM
  3. array problem
    By u-will-neva-no in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 2nd, 2011, 11:36 AM
  4. Problem with array
    By mingming8888 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: October 27th, 2010, 12:17 PM
  5. Java program for 2-D Array Maze
    By Peetah05 in forum Collections and Generics
    Replies: 11
    Last Post: May 8th, 2009, 04:30 AM