A minimalist Java console application for managing events and ticket reservations.
-
We want to create a ticket management application for events.
-
Our classes will be:
-
Address
- Street
- City
-
Venue (inherits from Address):
- Capacity
-
Ticket:
- Seat number
- Client
- Event
- Seat type (standard, gold, VIP)
-
Event:
- Name
- Venue
- Date
- Time
- Number of seats
- List of tickets
-
Client:
- Last name
- First name
- Address
- Age
- Phone number
- List of tickets
-
- Clients will be able to book tickets for different events, and each ticket will be linked to a specific event.
- For each event, it will be possible to retrieve the list of associated tickets.
- We want a user interface allowing CRUD operations (Create, Read, Update, Delete) for each entity.
- When searching for an element to display or add, if the specified index does not exist, we will throw a custom
NotFoundException, which will be handled in our UI.
- When booking a ticket for an event, we want to verify if there are still seats available.
src/
├── Main.java # Entry point: bootstraps app and menu
│
├── domain/ # Business entities and value objects
│ ├── Address.java
│ ├── Location.java (extends Address)
│ ├── Client.java
│ ├── Event.java
│ ├── Ticket.java
│ └── SeatType.java (enum)
│
├── domain/exception/ # Custom domain exceptions
│ ├── CrudException.java
│ ├── NotFoundException.java
│ └── CapacityFullException.java
│
├── repository/ # In-memory repositories
│ ├── Repository.java (interface)
│ └── MapRepository.java
│
├── service/ # Business services
│ └── TicketService.java
│
└── ui/ # Console interaction logic
├── Ihm.java (generic CRUD menu)
├── MainMenu.java
├── ClientPrompter.java
└── EventPrompter.java
- Java 21+
- Maven
mvn clean compile exec:javaThis will:
- Load demo data (1 client, 1 event, 1 reservation)
- Launch the interactive menu
- Supports different seat types:
STANDARD,GOLD,VIP - Prevents overbooking based on event capacity
- Manage clients and events via a reusable console interface
- Includes validation and exception handling
- Custom exceptions such as
NotFoundExceptionandCapacityFullException - All errors displayed gracefully to the user
- Generic
Ihm<T>handles entity-specific menus - Prompters (e.g.
ClientPrompter) isolate prompting logic
=== TICKETING MENU ===
1 - Manage clients
2 - Manage events
3 - Reserve ticket
0 - Exit
- Add or update a client (ID, name, address, age, phone)
- Add an event with name, location, capacity
- Reserve a ticket → ID check, seat number + type, capacity control
- Visual confirmation of success or error message
- Add new entities: reuse
Ihm<T>and aPrompter - Swap
MapRepositorywith SQL or file persistence - Build REST or JavaFX layer on top (UI decoupled from logic)