Search:

Type: Posts; User: javapenguin

Search: Search took 0.10 seconds.

  1. Replies
    22
    Views
    2,720

    Re: Using Random class

    Ok, maybe not a TreeMap.
  2. Replies
    22
    Views
    2,720

    Re: Using Random class

    It's something wrong with my ArrayList.

    Also, how do I get it to check each class to see if any other classes have students in common?

    Once done with that, I'd like to make a TreeMap.

    It'll...
  3. Replies
    22
    Views
    2,720

    Re: Using Random class

    No, the problem is my ArrayList of students in a class.

    Also, the java class Class has a <T> . Mine has no, what're they called? (Parameters in < >)

    Maybe data parameters is the word I'm...
  4. Replies
    22
    Views
    2,720

    Re: Using Random class

    classes[1].addStudents(st2[k2]);

    What's wrong with this code?
  5. Replies
    22
    Views
    2,720

    Re: Using Random class

    Let's see:


    Sleeping 101
    The class: Sleeping 101 is at 6:30 p.m.and has 15 students. The students in it are: [Abraham Lincoln, Joe McDonald, Thomas Edison, Luke Skywalker, Sherlock Holmes, Susan...
  6. Replies
    22
    Views
    2,720

    Re: Using Random class

    What's this used for:



    What goes in here?
  7. Replies
    22
    Views
    2,720

    Re: Using Random class

    package DiscreteMathProject;

    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.Random;
    import...
  8. Replies
    22
    Views
    2,720

    Re: Using Random class

    package DiscreteMathProject;

    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.Random;
    import...
  9. Replies
    22
    Views
    2,720

    Re: Using Random class

    Well, what's wrong with the getSize() method?
  10. Replies
    22
    Views
    2,720

    Re: Using Random class

    package DiscreteMathProject;

    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.Random;
    import...
  11. Replies
    22
    Views
    2,720

    Re: Using Random class

    Well, I should have the set methods called in the constructors to avoid having to call them in the for loops.

    Also, it's my getSize() method. Something is wrong there. Why is it going out of...
  12. Replies
    22
    Views
    2,720

    Re: Using Random class

    I still haven't gotten this part solved, and I'm having problems using UNIX now for something else and am kind of busy at the moment.
  13. Replies
    22
    Views
    2,720

    Re: Using Random class

    Code has been updated. Now the names will work, but I'm getting Index Out of Bounds and Null Pointer Exceptions still, and the number of students in the brackets and the number of students the the...
  14. Replies
    22
    Views
    2,720

    Re: Using Random class

    Random rand = new Random();
    Set<Student> mix = new HashSet<Student>();
    Student[] st = new Student[classes[0].getSize()];
    for ( int i = 0; i < classes[0].getSize(); i++ ){
    ...
  15. Replies
    22
    Views
    2,720

    Re: Using Random class

    package DiscreteMathProject;

    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.Random;
    import java.util.Set;

    public class MainClass {

    private String[] studentNames;
  16. Replies
    22
    Views
    2,720

    Re: Using Random class

    By loop count you mean like the 10 you put?

    So how will I add a random number of students? I set it to pick a random number of students, but I think it's creating an Array Index Out of Bounds...
  17. Replies
    22
    Views
    2,720

    Re: Using Random class

    Ok, why does it need to be getSize() + 1?


    for (int k = 0; k < classes[0].getSize() + 1; k++)
    {
    classes[0].add(students[k]);
    }

    and even then everything is null. Why?
  18. Replies
    22
    Views
    2,720

    Re: Using Random class

    Ahhh...I see that class size is random, and it will throw Index Out of Bounds somehow.

    Perhaps it'll fix that when I can figure out how to add the random size and add random, not same students,...
  19. Replies
    22
    Views
    2,720

    Using Random class

    I have a couple of classes, not related to my big project, which still is being ignored by everyone for some odd reason, that randomly pick a number of students as a class size and also randomly pick...
Results 1 to 19 of 20