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: ArrayList Help

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

    Default ArrayList Help

    Hello Everyone,

    I am having major problems with my code and I was wondering if someone could please help me out because I have been trying for a very long time to fix the problems, but really have no clue what to do. I am trying to write a program where members of a team each have a certain number of points ,but then they each get a percentage of their points deducted based on a formula. I already calculated how much each teammate gets deducted in a class and used a helper method called deduction(). Now, I want to put each teammate in an array list and have the deductions of each teammate in the array list. I then want the deductions to be added together to give me the total deductions of the team. However, I really don't know how to use array lists. Can anybody PLEASE help me?

    import java.util.ArrayList;
     
    public class Team {
     
    	ArrayList Teammember = new ArrayList();
     
     
     
    	public void teammemb(points teammember) {
     
    		Teammmember.add("mark");
    		Teammember.add("kevin");
    		Teammember.add("keith");
    		Teammember.add("eric");
     
    		team bluebirds = new team bluebirds;
     
     
    	}
     
    	public double totalDeductions() {
    		for(int i = 0; i < Teammember.size(); i++){
     
    			points teammember = (points) Teammember.get(i);
     
    		}
     
    		return Teammember.Deductions;
    	}


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: ArrayList Help

    Best way to solve your problems are with the following:




    "I don't get ArrayList, please help" isn't enough for us to go on and properly help you.
    You should either explain the exact areas you do not understand, and why or you should continue writing your programs and we will help you with any errors you get along the way.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. How to use an ArrayList and what is its advantage over array?
    By JavaPF in forum Java SE API Tutorials
    Replies: 4
    Last Post: December 21st, 2011, 03:44 AM
  2. private Map<String, ArrayList> xlist = new HashMap<String, ArrayList>();
    By Scotty in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 21st, 2011, 08:37 AM
  3. Ordering ArrayList by 3 conditions as you add to ArrayList
    By aussiemcgr in forum Collections and Generics
    Replies: 4
    Last Post: July 13th, 2010, 02:08 PM
  4. [SOLVED] Extracting an How to ArrayList from an ArrayList and convert to int??
    By igniteflow in forum Collections and Generics
    Replies: 2
    Last Post: August 16th, 2009, 01:11 PM
  5. How to use an ArrayList and what is its advantage over array?
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 1
    Last Post: May 17th, 2009, 01:12 PM