English
Tasks
Complete the task of the chosen difficulty level for your variant number.
Variants
Variant 1. A library
1. Initial level. Create a standalone Java/JDBC console program “Library” with PostgreSQL: books, readers, loans, DAO, and transactions. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Book fields: title, author, availability; lending to a reader makes the book unavailable. Report: the number of loans for each reader; prohibit lending the same book twice.
2. Basic level. Create a standalone Java/JDBC console program “Library” with PostgreSQL: books, readers, loans, DAO, and transactions. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Book fields: title, author, availability; lending to a reader makes the book unavailable. Report: the number of loans for each reader; prohibit lending the same book twice.
3. Advanced level. Create a standalone Java/JDBC program “Library” on PostgreSQL: books, readers, loans, DAO, and transactions. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Book fields: title, author, availability; lending to a reader makes the book unavailable. Report: the number of loans for each reader; prohibit lending the same book twice.
Variant 2. An online store
1. Initial level. Create a standalone Java/JDBC console program “Online store” with PostgreSQL: products, orders, transactional checkout with stock checks. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Product fields: name, price>0, stock≥0; an order decreases the stock. Report: a customer's order total; prohibit shortages.
2. Basic level. Create a standalone Java/JDBC console program “Online store” with PostgreSQL: products, orders, transactional checkout with stock checks. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Product fields: name, price>0, stock≥0; an order decreases the stock. Report: a customer's order total; prohibit shortages.
3. Advanced level. Create a standalone Java/JDBC program “Online store” on PostgreSQL: products, orders, transactional checkout with stock checks. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Product fields: name, price>0, stock≥0; an order decreases the stock. Report: a customer's order total; prohibit shortages.
Variant 3. A dean's office
1. Initial level. Create a standalone Java/JDBC console program “Dean's office” with PostgreSQL: students, groups, grades, and performance reports. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Student fields: full name, group; a grade 0..100 links a student and a course. Report: the group's average grade; prohibit duplicate grades.
2. Basic level. Create a standalone Java/JDBC console program “Dean's office” with PostgreSQL: students, groups, grades, and performance reports. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Student fields: full name, group; a grade 0..100 links a student and a course. Report: the group's average grade; prohibit duplicate grades.
3. Advanced level. Create a standalone Java/JDBC program “Dean's office” on PostgreSQL: students, groups, grades, and performance reports. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Student fields: full name, group; a grade 0..100 links a student and a course. Report: the group's average grade; prohibit duplicate grades.
Variant 4. An auto repair shop
1. Initial level. Create a standalone Java/JDBC console program “Auto repair shop” with PostgreSQL: customers, cars, repairs, and labor costs. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Car fields: license plate, model; a repair contains a service, a price, and a date. Report: costs per car; prohibit negative prices.
2. Basic level. Create a standalone Java/JDBC console program “Auto repair shop” with PostgreSQL: customers, cars, repairs, and labor costs. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Car fields: license plate, model; a repair contains a service, a price, and a date. Report: costs per car; prohibit negative prices.
3. Advanced level. Create a standalone Java/JDBC program “Auto repair shop” on PostgreSQL: customers, cars, repairs, and labor costs. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Car fields: license plate, model; a repair contains a service, a price, and a date. Report: costs per car; prohibit negative prices.
Variant 5. A movie theater
1. Initial level. Create a standalone Java/JDBC console program “Movie theater” with PostgreSQL: showings, seats, bookings with transactions. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Showing fields: movie, start, capacity; a ticket occupies a seat number. Report: tickets sold per showing; prohibit double-booking a seat.
2. Basic level. Create a standalone Java/JDBC console program “Movie theater” with PostgreSQL: showings, seats, bookings with transactions. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Showing fields: movie, start, capacity; a ticket occupies a seat number. Report: tickets sold per showing; prohibit double-booking a seat.
3. Advanced level. Create a standalone Java/JDBC program “Movie theater” on PostgreSQL: showings, seats, bookings with transactions. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Showing fields: movie, start, capacity; a ticket occupies a seat number. Report: tickets sold per showing; prohibit double-booking a seat.
Variant 6. An outpatient clinic
1. Initial level. Create a standalone Java/JDBC console program “Outpatient clinic” with PostgreSQL: doctors, patients, appointments without overlaps. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Patient fields: name, year of birth; an appointment links a doctor and a time. Report: appointments per doctor; prohibit a repeated time.
2. Basic level. Create a standalone Java/JDBC console program “Outpatient clinic” with PostgreSQL: doctors, patients, appointments without overlaps. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Patient fields: name, year of birth; an appointment links a doctor and a time. Report: appointments per doctor; prohibit a repeated time.
3. Advanced level. Create a standalone Java/JDBC program “Outpatient clinic” on PostgreSQL: doctors, patients, appointments without overlaps. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Patient fields: name, year of birth; an appointment links a doctor and a time. Report: appointments per doctor; prohibit a repeated time.
Variant 7. A hotel
1. Initial level. Create a standalone Java/JDBC console program “Hotel” with PostgreSQL: rooms, bookings, date overlap checks. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Room fields: name, price per night; a booking has a guest, a check-in date, and a check-out date. Report: total nights per room; prohibit overlaps.
2. Basic level. Create a standalone Java/JDBC console program “Hotel” with PostgreSQL: rooms, bookings, date overlap checks. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Room fields: name, price per night; a booking has a guest, a check-in date, and a check-out date. Report: total nights per room; prohibit overlaps.
3. Advanced level. Create a standalone Java/JDBC program “Hotel” on PostgreSQL: rooms, bookings, date overlap checks. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Room fields: name, price per night; a booking has a guest, a check-in date, and a check-out date. Report: total nights per room; prohibit overlaps.
Variant 8. A football league
1. Initial level. Create a standalone Java/JDBC console program “Football league” with PostgreSQL: teams, matches, a league table built by an SQL query. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Team fields: name, city; a match contains two different teams and goals≥0. Report: 3/1/0 points for a win/draw/loss. Schema: teams(id,name,city), matches(id,date), results(match_id,team_id,goals); a match has exactly two results rows with different teams.
2. Basic level. Create a standalone Java/JDBC console program “Football league” with PostgreSQL: teams, matches, a league table built by an SQL query. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Team fields: name, city; a match contains two different teams and goals≥0. Report: 3/1/0 points for a win/draw/loss. Schema: teams(id,name,city), matches(id,date), results(match_id,team_id,goals); a match has exactly two results rows with different teams.
3. Advanced level. Create a standalone Java/JDBC program “Football league” on PostgreSQL: teams, matches, a league table built by an SQL query. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Team fields: name, city; a match contains two different teams and goals≥0. Report: 3/1/0 points for a win/draw/loss. Schema: teams(id,name,city), matches(id,date), results(match_id,team_id,goals); a match has exactly two results rows with different teams. Transactionally add matches and two results; a failure after the first results row leaves no part of the new match.
Variant 9. Warehouse accounting
1. Initial level. Create a standalone Java/JDBC console program “Warehouse accounting” with PostgreSQL: receipts, write-offs, stock for a period. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Product fields: code, name, stock≥0; a movement has a quantity and a direction. Report: stock per warehouse; prohibit issuing more than the stock.
2. Basic level. Create a standalone Java/JDBC console program “Warehouse accounting” with PostgreSQL: receipts, write-offs, stock for a period. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Product fields: code, name, stock≥0; a movement has a quantity and a direction. Report: stock per warehouse; prohibit issuing more than the stock.
3. Advanced level. Create a standalone Java/JDBC program “Warehouse accounting” on PostgreSQL: receipts, write-offs, stock for a period. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Product fields: code, name, stock≥0; a movement has a quantity and a direction. Report: stock per warehouse; prohibit issuing more than the stock.
Variant 10. Flights
1. Initial level. Create a standalone Java/JDBC console program “Flights” with PostgreSQL: flights, passengers, check-in, and free seats. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Flight fields: number, departure, capacity; a booking has a passenger and a seat. Report: free seats; prohibit double booking.
2. Basic level. Create a standalone Java/JDBC console program “Flights” with PostgreSQL: flights, passengers, check-in, and free seats. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Flight fields: number, departure, capacity; a booking has a passenger and a seat. Report: free seats; prohibit double booking.
3. Advanced level. Create a standalone Java/JDBC program “Flights” on PostgreSQL: flights, passengers, check-in, and free seats. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Flight fields: number, departure, capacity; a booking has a passenger and a seat. Report: free seats; prohibit double booking.
Variant 11. A garden association
1. Initial level. Create a standalone Java/JDBC console program “Garden association” with PostgreSQL: plots, fees, members' debts. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Plot fields: number, area>0; a fee links an owner, a year, and an amount. Report: amount paid per owner; prohibit negative amounts.
2. Basic level. Create a standalone Java/JDBC console program “Garden association” with PostgreSQL: plots, fees, members' debts. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Plot fields: number, area>0; a fee links an owner, a year, and an amount. Report: amount paid per owner; prohibit negative amounts.
3. Advanced level. Create a standalone Java/JDBC program “Garden association” on PostgreSQL: plots, fees, members' debts. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Plot fields: number, area>0; a fee links an owner, a year, and an amount. Report: amount paid per owner; prohibit negative amounts.
Variant 12. A cookbook
1. Initial level. Create a standalone Java/JDBC console program “Cookbook” with PostgreSQL: recipes, ingredients, search by products. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Recipe fields: name, servings>0; the composition links an ingredient and grams>0. Report: the number of ingredients per recipe; prohibit duplicate composition entries.
2. Basic level. Create a standalone Java/JDBC console program “Cookbook” with PostgreSQL: recipes, ingredients, search by products. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Recipe fields: name, servings>0; the composition links an ingredient and grams>0. Report: the number of ingredients per recipe; prohibit duplicate composition entries.
3. Advanced level. Create a standalone Java/JDBC program “Cookbook” on PostgreSQL: recipes, ingredients, search by products. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Recipe fields: name, servings>0; the composition links an ingredient and grams>0. Report: the number of ingredients per recipe; prohibit duplicate composition entries.
Variant 13. A fitness club
1. Initial level. Create a standalone Java/JDBC console program “Fitness club” with PostgreSQL: memberships, visits, membership renewals. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Client fields: name; a membership has a start, an end, and a session limit. Report: a client's visits; prohibit entry outside the membership period.
2. Basic level. Create a standalone Java/JDBC console program “Fitness club” with PostgreSQL: memberships, visits, membership renewals. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Client fields: name; a membership has a start, an end, and a session limit. Report: a client's visits; prohibit entry outside the membership period.
3. Advanced level. Create a standalone Java/JDBC program “Fitness club” on PostgreSQL: memberships, visits, membership renewals. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Client fields: name; a membership has a start, an end, and a session limit. Report: a client's visits; prohibit entry outside the membership period.
Variant 14. A music collection
1. Initial level. Create a standalone Java/JDBC console program “Music collection” with PostgreSQL: artists, albums, tracks, duration. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Album fields: title, year; a track has an artist and a duration>0. Report: album duration; an empty album gives 0.
2. Basic level. Create a standalone Java/JDBC console program “Music collection” with PostgreSQL: artists, albums, tracks, duration. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Album fields: title, year; a track has an artist and a duration>0. Report: album duration; an empty album gives 0.
3. Advanced level. Create a standalone Java/JDBC program “Music collection” on PostgreSQL: artists, albums, tracks, duration. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Album fields: title, year; a track has an artist and a duration>0. Report: album duration; an empty album gives 0. Transactionally create an album for an existing artist together with its first track: nonempty titles, duration>0, a unique artist/album title pair. A failed track insertion rolls back the new album.
Variant 15. Bike rental
1. Initial level. Create a standalone Java/JDBC console program “Bike rental” with PostgreSQL: bikes, rentals, time-based payment. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Bike fields: code, rate>0; a rental has a customer and a start/end. Report: revenue per bike; prohibit a second active rental.
2. Basic level. Create a standalone Java/JDBC console program “Bike rental” with PostgreSQL: bikes, rentals, time-based payment. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Bike fields: code, rate>0; a rental has a customer and a start/end. Report: revenue per bike; prohibit a second active rental.
3. Advanced level. Create a standalone Java/JDBC program “Bike rental” on PostgreSQL: bikes, rentals, time-based payment. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Bike fields: code, rate>0; a rental has a customer and a start/end. Report: revenue per bike; prohibit a second active rental.
Variant 16. A real estate agency
1. Initial level. Create a standalone Java/JDBC console program “Real estate agency” with PostgreSQL: properties, agents, deals, and commissions. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Property fields: address, area>0, price>0; a viewing links a client and a date. Report: the number of viewings; prohibit identical entries.
2. Basic level. Create a standalone Java/JDBC console program “Real estate agency” with PostgreSQL: properties, agents, deals, and commissions. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Property fields: address, area>0, price>0; a viewing links a client and a date. Report: the number of viewings; prohibit identical entries.
3. Advanced level. Create a standalone Java/JDBC program “Real estate agency” on PostgreSQL: properties, agents, deals, and commissions. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Property fields: address, area>0, price>0; a viewing links a client and a date. Report: the number of viewings; prohibit identical entries.
Variant 17. Professional development courses
1. Initial level. Create a standalone Java/JDBC console program “Professional development courses” with PostgreSQL: learner enrollments and certificates. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Course fields: name, capacity>0; a registration links a learner and a course. Report: free places; prohibit registrations beyond capacity.
2. Basic level. Create a standalone Java/JDBC console program “Professional development courses” with PostgreSQL: learner enrollments and certificates. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Course fields: name, capacity>0; a registration links a learner and a course. Report: free places; prohibit registrations beyond capacity.
3. Advanced level. Create a standalone Java/JDBC program “Professional development courses” on PostgreSQL: learner enrollments and certificates. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Course fields: name, capacity>0; a registration links a learner and a course. Report: free places; prohibit registrations beyond capacity.
Variant 18. A veterinary clinic
1. Initial level. Create a standalone Java/JDBC console program “Veterinary clinic” with PostgreSQL: animals, owners, vaccinations, and reminders. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Animal fields: name, species; a visit has an owner, a date, and a cost≥0. Report: an owner's expenses; reject an unknown animal.
2. Basic level. Create a standalone Java/JDBC console program “Veterinary clinic” with PostgreSQL: animals, owners, vaccinations, and reminders. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Animal fields: name, species; a visit has an owner, a date, and a cost≥0. Report: an owner's expenses; reject an unknown animal.
3. Advanced level. Create a standalone Java/JDBC program “Veterinary clinic” on PostgreSQL: animals, owners, vaccinations, and reminders. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Animal fields: name, species; a visit has an owner, a date, and a cost≥0. Report: an owner's expenses; reject an unknown animal.
Variant 19. A help desk
1. Initial level. Create a standalone Java/JDBC console program “Help desk” with PostgreSQL: tickets, statuses, response time. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Ticket fields: subject, status new/open/done; an assignment contains an employee. Report: an employee's unresolved tickets; prohibit closing a ticket twice.
2. Basic level. Create a standalone Java/JDBC console program “Help desk” with PostgreSQL: tickets, statuses, response time. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Ticket fields: subject, status new/open/done; an assignment contains an employee. Report: an employee's unresolved tickets; prohibit closing a ticket twice.
3. Advanced level. Create a standalone Java/JDBC program “Help desk” on PostgreSQL: tickets, statuses, response time. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Ticket fields: subject, status new/open/done; an assignment contains an employee. Report: an employee's unresolved tickets; prohibit closing a ticket twice.
Variant 20. A gaming platform
1. Initial level. Create a standalone Java/JDBC console program “Gaming platform” with PostgreSQL: games, players, achievements, and ratings. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Game fields: title, price≥0; a purchase links a player and a game. Report: a player's spending; prohibit repeated purchases.
2. Basic level. Create a standalone Java/JDBC console program “Gaming platform” with PostgreSQL: games, players, achievements, and ratings. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Game fields: title, price≥0; a purchase links a player and a game. Report: a player's spending; prohibit repeated purchases.
3. Advanced level. Create a standalone Java/JDBC program “Gaming platform” on PostgreSQL: games, players, achievements, and ratings. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Game fields: title, price≥0; a purchase links a player and a game. Report: a player's spending; prohibit repeated purchases.
Variant 21. A school cafeteria
1. Initial level. Create a standalone Java/JDBC console program “School cafeteria” with PostgreSQL: menu, orders, student balances. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Dish fields: name, price>0; the menu links a date and the available quantity. Report: the cost of orders per day; prohibit running out of portions.
2. Basic level. Create a standalone Java/JDBC console program “School cafeteria” with PostgreSQL: menu, orders, student balances. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Dish fields: name, price>0; the menu links a date and the available quantity. Report: the cost of orders per day; prohibit running out of portions.
3. Advanced level. Create a standalone Java/JDBC program “School cafeteria” on PostgreSQL: menu, orders, student balances. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Dish fields: name, price>0; the menu links a date and the available quantity. Report: the cost of orders per day; prohibit running out of portions.
Variant 22. A corporate vehicle fleet
1. Initial level. Create a standalone Java/JDBC console program “Corporate vehicle fleet” with PostgreSQL: cars, drivers, trips, fuel. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Car fields: license plate, mileage≥0; a trip has a driver and kilometers>0. Report: a driver's mileage; recording a trip increases the car's mileage.
2. Basic level. Create a standalone Java/JDBC console program “Corporate vehicle fleet” with PostgreSQL: cars, drivers, trips, fuel. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Car fields: license plate, mileage≥0; a trip has a driver and kilometers>0. Report: a driver's mileage; recording a trip increases the car's mileage.
3. Advanced level. Create a standalone Java/JDBC program “Corporate vehicle fleet” on PostgreSQL: cars, drivers, trips, fuel. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Car fields: license plate, mileage≥0; a trip has a driver and kilometers>0. Report: a driver's mileage; recording a trip increases the car's mileage.
Variant 23. A scientific conference
1. Initial level. Create a standalone Java/JDBC console program “Scientific conference” with PostgreSQL: talks, sections, participant registration. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Section fields: name, capacity>0; a talk has an author and a section. Report: the number of talks; prohibit exceeding capacity.
2. Basic level. Create a standalone Java/JDBC console program “Scientific conference” with PostgreSQL: talks, sections, participant registration. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Section fields: name, capacity>0; a talk has an author and a section. Report: the number of talks; prohibit exceeding capacity.
3. Advanced level. Create a standalone Java/JDBC program “Scientific conference” on PostgreSQL: talks, sections, participant registration. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Section fields: name, capacity>0; a talk has an author and a section. Report: the number of talks; prohibit exceeding capacity.
Variant 24. Equipment tracking
1. Initial level. Create a standalone Java/JDBC console program “Equipment tracking” with PostgreSQL: inventory, assignment to employees, write-offs. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Equipment fields: inventory code, name; an issue has an employee and a return date. Report: unreturned items; prohibit issuing the same item twice.
2. Basic level. Create a standalone Java/JDBC console program “Equipment tracking” with PostgreSQL: inventory, assignment to employees, write-offs. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Equipment fields: inventory code, name; an issue has an employee and a return date. Report: unreturned items; prohibit issuing the same item twice.
3. Advanced level. Create a standalone Java/JDBC program “Equipment tracking” on PostgreSQL: inventory, assignment to employees, write-offs. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Equipment fields: inventory code, name; an issue has an employee and a return date. Report: unreturned items; prohibit issuing the same item twice.
Variant 25. A weather station network
1. Initial level. Create a standalone Java/JDBC console program “Weather station network” with PostgreSQL: stations, measurements, aggregated reports. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Station fields: name, city; a measurement has a time and a temperature of -90..60. Report: the daily average temperature; prohibit a duplicate time for a station.
2. Basic level. Create a standalone Java/JDBC console program “Weather station network” with PostgreSQL: stations, measurements, aggregated reports. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Station fields: name, city; a measurement has a time and a temperature of -90..60. Report: the daily average temperature; prohibit a duplicate time for a station.
3. Advanced level. Create a standalone Java/JDBC program “Weather station network” on PostgreSQL: stations, measurements, aggregated reports. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Station fields: name, city; a measurement has a time and a temperature of -90..60. Report: the daily average temperature; prohibit a duplicate time for a station.
Variant 26. A travel agency
1. Initial level. Create a standalone Java/JDBC console program “Travel agency” with PostgreSQL: tours, customers, installment payments. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Tour fields: name, price>0, capacity; a booking has a tourist and seats>0. Report: tour revenue; prohibit running out of seats.
2. Basic level. Create a standalone Java/JDBC console program “Travel agency” with PostgreSQL: tours, customers, installment payments. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Tour fields: name, price>0, capacity; a booking has a tourist and seats>0. Report: tour revenue; prohibit running out of seats.
3. Advanced level. Create a standalone Java/JDBC program “Travel agency” on PostgreSQL: tours, customers, installment payments. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Tour fields: name, price>0, capacity; a booking has a tourist and seats>0. Report: tour revenue; prohibit running out of seats.
Variant 27. A pharmacy
1. Initial level. Create a standalone Java/JDBC console program “Pharmacy” with PostgreSQL: medicines, prescriptions, expiration dates. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Drug fields: name; a batch has an expiration date and a stock≥0. Report: available stock; prohibit selling an expired batch.
2. Basic level. Create a standalone Java/JDBC console program “Pharmacy” with PostgreSQL: medicines, prescriptions, expiration dates. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Drug fields: name; a batch has an expiration date and a stock≥0. Report: available stock; prohibit selling an expired batch.
3. Advanced level. Create a standalone Java/JDBC program “Pharmacy” on PostgreSQL: medicines, prescriptions, expiration dates. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Drug fields: name; a batch has an expiration date and a stock≥0. Report: available stock; prohibit selling an expired batch.
Variant 28. A charity fund
1. Initial level. Create a standalone Java/JDBC console program “Charity fund” with PostgreSQL: donors, donations, projects, and reporting. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Campaign fields: name, goal>0; a donation has a donor and an amount>0. Report: the amount raised; recording a donation updates the campaign total.
2. Basic level. Create a standalone Java/JDBC console program “Charity fund” with PostgreSQL: donors, donations, projects, and reporting. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Campaign fields: name, goal>0; a donation has a donor and an amount>0. Report: the amount raised; recording a donation updates the campaign total.
3. Advanced level. Create a standalone Java/JDBC program “Charity fund” on PostgreSQL: donors, donations, projects, and reporting. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Campaign fields: name, goal>0; a donation has a donor and an amount>0. Report: the amount raised; recording a donation updates the campaign total.
Variant 29. Housing rental
1. Initial level. Create a standalone Java/JDBC console program “Housing rental” with PostgreSQL: listings, tenants, leases. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Housing fields: address, monthly price>0; a lease has a tenant and a date interval. Report: the total of leases; prohibit overlapping lease periods for a property. Leases are allowed only from the first day of a month to the first day of a later month; the end is exclusive, and the amount equals the monthly price times the number of full calendar months. Reject other dates.
2. Basic level. Create a standalone Java/JDBC console program “Housing rental” with PostgreSQL: listings, tenants, leases. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Housing fields: address, monthly price>0; a lease has a tenant and a date interval. Report: the total of leases; prohibit overlapping lease periods for a property. Leases are allowed only from the first day of a month to the first day of a later month; the end is exclusive, and the amount equals the monthly price times the number of full calendar months. Reject other dates.
3. Advanced level. Create a standalone Java/JDBC program “Housing rental” on PostgreSQL: listings, tenants, leases. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Housing fields: address, monthly price>0; a lease has a tenant and a date interval. Report: the total of leases; prohibit overlapping lease periods for a property. Leases are allowed only from the first day of a month to the first day of a later month; the end is exclusive, and the amount equals the monthly price times the number of full calendar months. Reject other dates.
Variant 30. An administrative services center
1. Initial level. Create a standalone Java/JDBC console program “Administrative services center” with PostgreSQL: services, queue tickets, service statistics. For the main entity, define an id, a name, and one domain attribute. Through a menu, add, view, edit, and delete records by id; report invalid input and a missing id explicitly. Use PreparedStatement and try-with-resources, and show that data persists after a restart. Service fields: name, duration>0; an appointment contains an applicant, a window, and a time. Report: appointments per day; prohibit simultaneous appointments at one window.
2. Basic level. Create a standalone Java/JDBC console program “Administrative services center” with PostgreSQL: services, queue tickets, service statistics. Define three related tables with keys and constraints, and implement a DAO and a menu for entering operations. Print a JOIN report with grouping, a count, or an exact sum by the main entity; include empty groups and define the order. Test duplicates, foreign keys, and SQL-like text as an ordinary value. Service fields: name, duration>0; an appointment contains an applicant, a window, and a time. Report: appointments per day; prohibit simultaneous appointments at one window.
3. Advanced level. Create a standalone Java/JDBC program “Administrative services center” on PostgreSQL: services, queue tickets, service statistics. Separate the DAO and a service for a transactional operation that modifies at least two tables; check a domain invariant and a concurrency conflict. Accept --config=path, --action=add|list|report, --record=field:value,..., and --help; with no arguments, provide a menu. Print an aligned report with totals; errors go to stderr; exit codes 0/2/1. Add JUnit tests for rollback after the first change, an unknown key, an empty database, and rereading with a new connection; do not store secrets in Git. Service fields: name, duration>0; an appointment contains an applicant, a window, and a time. Report: appointments per day; prohibit simultaneous appointments at one window.
Procedure
- Build a PostgreSQL schema with keys and constraints.
- Configure a separate role, the JDBC driver, and a configuration with no secrets in Git.
- Implement the DAO, parameterized queries, and a domain transaction.
- Verify the data with a new connection after commit and rollback.
- Test an empty result, SQL-like text, and a key violation.
- Show the test report and explain the isolation of the concurrent scenario.