Is this the way to do it?
Are there any examples on how to use the
(char)65
?
Quote : You will have to pseudo-generate the letters in your sequences. For example, we know that the ASCII value[^] for capital 'A' is 65. You can therefore use (char)65 to print the letter out. If you add the value of i to this, you will then get your B and your C (etc.) on subsequent lines.
String Alpha[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
<big>
int i = (char)65;
int j = (char)65;
</big>
System.out.println("X = Seat occupied"+"\n\n"+" <<--------- SCREEN ---------- >>");
for(i = 0; i < 5; i++)
{
for(j = 0; j < 5; j++)
{
String seating =(seat[i][j]==true)?" [X] ":" [ ] ";
System.out.print(seating);
}
System.out.println("");
}
System.out.print("\nPlease choose a seat:");
String chooseSeat = scanStr.nextLine();
And about using String.format, is is something like this:
String format = "what to place here..."
System.out.format(format, "[ ]", "[ ]", "[ ]","[ ]", "[ ]");
System.out.format(format, "[ ]", "[ ]", "[ ]","[ ]", "[ ]");
System.out.format(format, "[ ]", "[ ]", "[ ]","[ ]", "[ ]");
System.out.format(format, "[ ]", "[ ]", "[ ]","[ ]", "[ ]");
System.out.format(format, "[ ]", "[ ]", "[ ]","[ ]", "[ ]");
Any examples or codes to change the way I build my seating variable and have it print the correct letter and the number representing the element in the array that I am currently drawing?
Sorry if I misunderstood or not really understood your tips ..
Just need more "bread crumbs" or clues.
:confused: