Skip to content

Project · Java Programming (Core to Spring Boot)

Project: chair-car seat booking

Projectbeginner· about 5 hours· 6 steps

The brief

You build the core of a train seat booking system for one chair-car coach, the kind of thing IRCTC does at a huge scale: a seat map in a 2D array, seat numbers like 3B parsed from text, fares with a child rule and GST, tickets with unique PNRs, a passenger chart and cancellations that free the seat.

Why it matters

Booking systems (trains, buses, cinemas, clinics, hostels) are among the most common projects in Indian IT services and in fresher interviews. This one uses everything from the beginner level together: arrays, Strings, methods, classes, records and static members, and it is small enough to explain line by line in an interview.

Skills you practise

  • 2D boolean arrays
  • parsing text with substring and charAt
  • switch expressions and the ternary
  • classes and records
  • static counters
  • printf tables
  • removing from an array

You need

  • JDK 21 (Eclipse Temurin from adoptium.net or Oracle JDK; JDK 17 or any newer version also works)
  • A text editor or IDE (VS Code with the Extension Pack for Java, or IntelliJ IDEA Community Edition) and a terminal

What you will have at the end

Coach.java, Ticket.java, Train.java and BookingApp.java in a folder with a short README, and the full output of one run: bookings, fares, the chart and a cancellation.

How it is marked (rubric, 100 points)
Correct behaviourEvery check passes: seat parsing and its edge cases, fares, unique PNRs, the chart and the cancellation that frees the seat.40
Class designCoach owns the seat map, Train owns the tickets, Ticket is an immutable record, only the PNR counter is static.25
Robust input handlingBad seat numbers give a message, never an exception.15
Readable code and READMESmall methods with clear names; the README says how to build, run and extend it.20

0/6 steps done

Step 1 of 6

The seat map

A new coach reports Coach C1: 50 seats, 50 free.

This simplified chair car has 10 rows of 5 seats, A to E. booked is a boolean[10][5]: a new boolean array is all false, which means every seat starts free. totalSeats is rows × seats per row. freeSeats counts the false values with a nested for-each: the outer loop gives each row (a boolean[]), the inner loop each seat in it.

Run this on your machine, then paste the output below
$ javac *.java java BookingApp
Your notes: Coach.java, Ticket.java, Train.java, BookingApp.java

Write down each command you ran. It goes into your project summary.