User Profile

Collapse

Profile Sidebar

Collapse
Energizer100
Energizer100
Last Activity: Mar 24 '08, 02:40 PM
Joined: Nov 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Yeah, my idea for it was to make a new ArrayList.

    So it would be something like,

    Code:
    ArrayList<Actor> valLocs = getGrid - getOccupiedLocations.
    something along those lines...
    See more | Go to post

    Leave a comment:


  • Yeah it is. I basically have to create a new type of Actor....
    See more | Go to post

    Leave a comment:


  • Anyone know this year's GridWorld code? I need help on making a class.

    Code:
    public class fly extends Actor
    {
    	public fly()
    	{
    		setColor(Color.BLACK);
    	}
    	
    	public fly(Color flyColor)
    	{
    		setColor(flyColor);
    	}
    	
    	public void act()
    	{
    		if (canMove())
    		{
    			move();
    		}
    		else
    		{
    			turn();
    		}
    	}
    	
    	public void move()
    	{
    		if (getGrid() ==
    ...
    See more | Go to post

  • Energizer100
    replied to Need help with a few javabats
    in Java
    Yeah, I did it like that. It works. Thanks...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Need help with a few javabats
    in Java
    yeah. i got that. what about the rset?...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Need help with a few javabats
    in Java
    I check whether or not there are spaces to the left and to the right of it, if there is, its a single digit and i keep checking to get the entire number, or I can check if there is a letter to the left or to the right of it...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Need help with a few javabats
    in Java
    yeah, i forgot to put ret string in the other method. For a string like "7 11", it has a space in it, so I want to condense it. Yeah, i see what u mean.

    First I would check each char and see whether or not it is a int. then i have to do something ot check whether or not it is a double digit or a single digit, im having some trouble there...
    See more | Go to post

    Leave a comment:


  • Energizer100
    started a topic Need help with a few javabats
    in Java

    Need help with a few javabats

    hi, i need help with a couple of javabats.

    1) http://javabat.com/prob?id=String3 .sumNumbers

    Code:
    public int sumNumbers(String str) {
      
      String retString = "";
      String m = "";
      int temp = 0;
      
      for (int k = 0; k < str.length(); k++)
        {
          char c = str.charAt(k);
          if (Character.isLetterOrDigit(c))
    	{
    ...
    See more | Go to post

  • Energizer100
    replied to Uses of Array List
    in Java
    I see. Yeah, ArrayLists are much easier to use.
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    i was thinking about using an array.... would that help...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    Heh, yeah.

    But my idea, in code, for it is to make different variables to store each number. But that would take forever....
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    I would tally each number that appeared and then see which one appeared the most.

    To determine the mode, I have to see which number appears the most....
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    from 0 - 99

    I would calculate the mode by hand by doing:

    Storing each value into a variable and just adding 1 to it everytime i pass it. Then i print out the one that has the highest number.

    But doing it that way would take forever....
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    Heh, never mind, I got it.

    Okay, now here is the hardest part

    I need to find the mode of the Array List, meaning the number that appears the most...

    Code:
    import java.util.ArrayList;
    import java.lang.Math;
    import java.text.DecimalFormat;
    
    public class Statistics
    {
    	public static void main(String args[])
    	{
    		DecimalFormat df1 = new DecimalFormat("####.00");
    ...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    I did the Standard Deviation, but I want to round this off to 2 decimal places

    Code:
    import java.util.ArrayList;
    import java.lang.Math;
    
    public class Statistics
    {
    	public static void main(String args[])
    	{
    		ArrayList <Integer> intList = new ArrayList <Integer>();
    		double count1 = 0.0;
    		double sdTemp = 0.0;
    		
    		for (int k = 0; k < 10; k++)
    ...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    Ooh, thanks. I got it working.

    The next part of my program needs to find the Standard Deviation of the Array List.

    This is how to find it


    a. Find the average of the list of numbers.
    b. Determine the difference of each number from the average, and square each difference. Sum all the differences.
    c. Divide this sum by (the number of values - 1).
    d. Take the square root...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    I thought that by default ArrayList <integer> intList = new ArrayList <integer>() has the size of 10....

    So how do I set the size?...
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    oh

    count is 0.0

    and intList is 0

    but why? I am adding random numbers to the Array List. and the () at the end of the declaration of the Array List should equal 10. So intList.size() should be 10. and count should be all the random numbers added together.......
    See more | Go to post

    Leave a comment:


  • Energizer100
    replied to Uses of Array List
    in Java
    Code:
    import java.util.ArrayList;
    
    public class Statistics
    {
    	public static void main(String args[])
    	{
    		ArrayList <Integer> intList = new ArrayList <Integer>();
    		
    		int size = intList.size();
    		for (int k = 0; k < size); k++)
    			{
      				intList.add((int)(Math.random()*100));
    			}
    	
    		double count1 = 0;
    		for (int i = 0; i <
    ...
    See more | Go to post

    Leave a comment:


  • Energizer100
    started a topic Uses of Array List
    in Java

    Uses of Array List

    Hey. I'm having some difficulty in Array lists. I have to find the average of all the numbers in an array list. That's my first task. My second one is to find the mode of all the numbers, meaning the number that shows up the most. And the third one is to find a standard deviation, which I will get to later.

    Anyway, right now I'm doing Average.

    Code:
    public class Statistics
    {
    	public static void main(String
    ...
    See more | Go to post
No activity results to display
Show More
Working...