Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cinema implements ICinema {
- public static ArrayList<Seat> arrayOfSeats;
- public static CinemaException exception;
- @Override
- public void init(int rows, int columns) throws ICinemaInitCinemaException {
- arrayOfSeats = new ArrayList<>();
- Seat seat = new Seat();
- if((rows >= 1 && rows <= 26) && (columns >= 1 && columns <=100)) {
- for(int i = 0; i < rows; i++ ) {
- for(int j = 1; j <= columns; j++) {
- seat.setRow(String.valueOf((char)(('A' + i))));
- seat.setColumn(String.valueOf(j));
- arrayOfSeats.add(seat);
- }
- }
- } else {
- exception = new CinemaException();
- throw new ICinemaInitCinemaException("Init error", exception);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement