Seating Charts Download

Christina Cacioppo

arraylists, 2d arrays, for loops, if statements Student approved


A nearby school needs you: their computers just crashed, and they lost their seating chart software. Fortunately, you can help!


  1. Write a constructor for the SeatingChart class. The constructor should initialize instance variable seats to a 2-dimensional array with the number of rows and columns given in the parameters.
  2. Then, copy students from studentList to seats, starting at seats[0][0] and looping through its rows and columns. Empty seats should be null.

Starter code

class SeatingChart{
	private Student[][] seats;

	/* @ param 	studentList – students needing seats
	 * @ param	rows – the number of rows of seats
	 * @ param	cols – the number of columns of seats
	public SeatingChart(ArrayList studentList, int cols, int rows){
		// Code to initialize seats 

class Student{
	private String name;
	private int absences;

	// Constructor – creates a Student object
	public Student(String studentName){
		name = studentName;

	public String toString(){
		return name;

	public String getName(){
		return name;

	public int getAbsenceCount(){
		return absences;

Expected output

For example, suppose `ArrayList roster` looked like:
Then we'd want expect the `SeatingChart` created with `SeatingChart(roster, 2, 6)` to look like:

Useful tools to solve the problem