Re: BlueJ don't know what i did wrong
marvin...@htp-tel.de wrote:
I hope that is what you meant by making it easierr to read:
You tell us. Is that easy to read?
public class RandomFigures
{
public String [] Name;
Follow the naming conventions. Also, you'll learn that members like this
should be 'private' with methods to get ('getName()') and set ('setName()')
the attributes.
public int [] points;
public int [] assisting;
public int [] help;
public int [] helpstillyet;
public int [] stillthere;
...
Parallel arrays are not the data structure you should use. The correlation
between these arrays and their meanings are not enforced. A class is supposed
to collect correlated information. Also, follow the Java naming conventions.
So:
public class RandomFigure
{
private String name;
private int point;
private int assisting;
private int help;
private int helpStillYet;
private int stillThere;
public RandomFigure( String name, int point, int assisting, int help,
int helpStillYet, int stillThere )
{
this.name = name;
this.point = point;
this.assisting = assisting;
this.help = help;
this.helpStillYet = helpStillYet;
this.stillThere = stillThere;
}
... // getXxx() and setXxx() methods
}
Then you can have an array of these correlated attribute things:
RandomFigure [] figures = new RandomFigure [160]; // or whatever magic number
RandomFigure [0] =
new RandomFigure( "Cyprien Esenwein", 150, -1, -1, -1, -1);
etc.
Just a start.
--
Lew