everyone. I have been thinking this for 3 hours, just cannot figure out. I have a program that requires reading the file into a 2D array. The file is like:
...##..#####........
########....####..##
.........##.........
#.#.#.#.#.#.#.#.#.#.
Basically, it is about a seat reservation system.
" . "means opened seats. " # " means reserved seats. The row and col are unknown to me, depend on the file. But every row has the same number of seats.
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Arrays;
public class Main
{
public static void main(String[] args) throws Exception
{
int rows = 0, cols = 0;
char[][] auditorium = new char[rows][cols];
Scanner sc = new Scanner(new BufferedReader(new FileReader("A1.txt")));
}
I am new to java, really don't have any thoughts on this program. Please read the file and put the data into a char 2D array.