ChrisEvaristo / Programacao-Avancada

Expandindo Conhecimento de Programação Avancada com orientação do Professor Cunha
0 stars 0 forks source link

continuando exercicio 4 #23

Open ChrisEvaristo opened 4 years ago

ChrisEvaristo commented 4 years ago

import java.util.*;

public class Line { private List cells = new ArrayList();

public void print() { int cellsCount = cells.size();

// print the line
int size = (cells.size() * 17) + (cellsCount + 1);
char[] line = new char[size];
java.util.Arrays.fill(line, '-');

System.out.println(" " + new String(line));

for (Cell c : cells) {
  c.print();
}

// print the bord
System.out.println(" |");

}

public void add(Cell c) { cells.add(c); } }