public class Carriage{ private double[] seats; // 1D array to hold seats private int currentSeat; //index of next unsold seat private int id; // identifier of carriage /** * Constructor for objects of class Carriage */ public Carriage(double i,int j) //i as seats j as id { // initialise instance variables double[] seats = new double[i]; int i = 0; //initialise array values to -1.0 (due to double) while (i < seats.length){ seats[i] = -1.0; i++; } id = j; // id takes the int value of j currentSeat = 0; // currentSeat set to 0 }