I have to create a bingo game that runs through until it wins. I have created a new class called ASet. This class is sort of like a collection, storing generic data of any type
and having implemented a SetInterface I created.
The card has to look like this...
|----|----|----|----|----|
| B | I | N | G | O |
|----|----|----|----|----|
| 2| 27| 33| 55| 62|
.....and so on with the Middle N column a Zero.
So my problem here is when ever the number is found it is replaced with a zero. This messes up the columns pushing them out of line when it is two digits.
I tried making tags to put in when it goes to a zero but it is all going wrong still. Any help would greatly be appreciated. I will put my code for printing out
the card as I have it now but it is really messy. If you need anymore information to better help me out just let me know. Thanks!
CODE
System.out.println("|----|----|----|----|----|");
System.out.println("| B | I | N | G | O |");
System.out.println("|----|----|----|----|----|");
String tag = new String();
String tag2 = new String();
String tag3 = new String();
String tag4 = new String();
String tag5 = new String();
for (int index1 = 0; index1 <= 1; index1++) {
if (bColumn.getEntry(index1) <= 9) {
tag = " ";
}
if (iColumn.getEntry(index1) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(index1) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(index1) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(index1) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(index1) + "| " + tag2 + iColumn.getEntry(index1) + "| " + tag3
+ nColumn.getEntry(index1) + "| " + tag4 + gColumn.getEntry(index1) + "| " + tag5 + oColumn.getEntry(index1) + "| ");
}
if (bColumn.getEntry(2) <= 9) {
if (bColumn.getEntry(2) <= 9) {
tag = " ";
}
if (iColumn.getEntry(2) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(2) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(2) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(2) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(2) + "| " + tag2 + iColumn.getEntry(2) + "| "
+ tag3 + "0| " + tag4 + gColumn.getEntry(2) + "| " + tag5 + oColumn.getEntry(2) + "| ");
}
for (int index1 = 3; index1 <= 4; index1++) {
if (bColumn.getEntry(index1) <= 9) {
tag = " ";
}
if (iColumn.getEntry(index1) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(index1) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(index1) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(index1) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(index1) + "| " + tag2 + iColumn.getEntry(index1) + "| "
+ tag3 + nColumn.getEntry(index1) + "| " + tag4 + gColumn.getEntry(index1) + "| " + tag5 + oColumn.getEntry(index1) + "| ");
}
System.out.println("|----|----|----|----|----|");
QUOTE(rge @ 3 Jun, 2008 - 07:43 PM)

I have to create a bingo game that runs through until it wins. I have created a new class called ASet. This class is sort of like a collection, storing generic data of any type
and having implemented a SetInterface I created.
The card has to look like this...
|----|----|----|----|----|
| B | I | N | G | O |
|----|----|----|----|----|
| 2| 27| 33| 55| 62|
.....and so on with the Middle N column a Zero.
So my problem here is when ever the number is found it is replaced with a zero. This messes up the columns pushing them out of line when it is two digits.
I tried making tags to put in when it goes to a zero but it is all going wrong still. Any help would greatly be appreciated. I will put my code for printing out
the card as I have it now but it is really messy. If you need anymore information to better help me out just let me know. Thanks!
CODE
System.out.println("|----|----|----|----|----|");
System.out.println("| B | I | N | G | O |");
System.out.println("|----|----|----|----|----|");
String tag = new String();
String tag2 = new String();
String tag3 = new String();
String tag4 = new String();
String tag5 = new String();
for (int index1 = 0; index1 <= 1; index1++) {
if (bColumn.getEntry(index1) <= 9) {
tag = " ";
}
if (iColumn.getEntry(index1) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(index1) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(index1) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(index1) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(index1) + "| " + tag2 + iColumn.getEntry(index1) + "| " + tag3
+ nColumn.getEntry(index1) + "| " + tag4 + gColumn.getEntry(index1) + "| " + tag5 + oColumn.getEntry(index1) + "| ");
}
if (bColumn.getEntry(2) <= 9) {
if (bColumn.getEntry(2) <= 9) {
tag = " ";
}
if (iColumn.getEntry(2) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(2) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(2) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(2) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(2) + "| " + tag2 + iColumn.getEntry(2) + "| "
+ tag3 + "0| " + tag4 + gColumn.getEntry(2) + "| " + tag5 + oColumn.getEntry(2) + "| ");
}
for (int index1 = 3; index1 <= 4; index1++) {
if (bColumn.getEntry(index1) <= 9) {
tag = " ";
}
if (iColumn.getEntry(index1) == 0) {
tag2 = " ";
}
if (nColumn.getEntry(index1) == 0) {
tag3 = " ";
}
if (gColumn.getEntry(index1) == 0) {
tag4 = " ";
}
if (oColumn.getEntry(index1) == 0) {
tag5 = " ";
}
System.out.println("| " + tag + bColumn.getEntry(index1) + "| " + tag2 + iColumn.getEntry(index1) + "| "
+ tag3 + nColumn.getEntry(index1) + "| " + tag4 + gColumn.getEntry(index1) + "| " + tag5 + oColumn.getEntry(index1) + "| ");
}
System.out.println("|----|----|----|----|----|");
p.s. the design of the card does not really show up right but everything is suppose to be lined up in the columns.
This post has been edited by rge: 3 Jun, 2008 - 06:44 PM