Ok, maybe not a TreeMap.
Type: Posts; User: javapenguin
Ok, maybe not a TreeMap.
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...
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...
classes[1].addStudents(st2[k2]);
What's wrong with this code?
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...
What's this used for:
What goes in here?
package DiscreteMathProject;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import...
package DiscreteMathProject;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import...
Well, what's wrong with the getSize() method?
package DiscreteMathProject;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import...
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...
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.
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...
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++ ){
...
package DiscreteMathProject;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
public class MainClass {
private String[] studentNames;
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...
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?
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,...
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...