Write a Java application that will simulate a simple airline reservation system. First, you will create the database on your computer using the supplied script. As illustrated in the video, when the user runs the application for the first time, all seats are green which means “available” (because seat.s_reserved column’s values are set to 0 by the script). Once a seat of a flight is clicked, it turns red and the database is updated accordingly. ----------------- This is the database ready created: CREATE DATABASE IF NOT EXISTS `airlinereservationdb`; USE `airlinereservationdb`; DROP TABLE IF EXISTS `flight`; CREATE TABLE `flight` ( `f_code` char(5) NOT NULL, `f_origin` varchar(45) NOT NULL, `f_destination` varchar(45) NOT NULL, PRIMARY KEY (`f_code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `flight` WRITE; INSERT INTO `flight` VALUES ('AUI22','London','Melbourne'),('AUI33','Berlin','Texas'),('AUI44','Moscow','Madrid'); UNLOCK TABLES; DROP TABLE IF EXISTS `seat`; CREATE TABLE `seat` ( `s_number` char(3) NOT NULL,

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a Java application that will simulate a simple airline reservation system.
First, you will create the database on your computer using the supplied script.
As illustrated in the video, when the user runs the application for the first time, all seats
are green which means “available” (because seat.s_reserved column’s values are set to
0 by the script). Once a seat of a flight is clicked, it turns red and the database is
updated accordingly.

-----------------

This is the database ready created:

CREATE DATABASE IF NOT EXISTS `airlinereservationdb`;
USE `airlinereservationdb`;

DROP TABLE IF EXISTS `flight`;
CREATE TABLE `flight` (
`f_code` char(5) NOT NULL,
`f_origin` varchar(45) NOT NULL,
`f_destination` varchar(45) NOT NULL,
PRIMARY KEY (`f_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `flight` WRITE;
INSERT INTO `flight` VALUES ('AUI22','London','Melbourne'),('AUI33','Berlin','Texas'),('AUI44','Moscow','Madrid');
UNLOCK TABLES;

DROP TABLE IF EXISTS `seat`;
CREATE TABLE `seat` (
`s_number` char(3) NOT NULL,
`s_reserved` tinyint(1) NOT NULL,
`f_code` char(5) NOT NULL,
PRIMARY KEY (`s_number`,`f_code`),
KEY `fk_seat_flight_idx` (`f_code`),
CONSTRAINT `fk_seat_flight` FOREIGN KEY (`f_code`) REFERENCES `flight` (`f_code`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


LOCK TABLES `seat` WRITE;
INSERT INTO `seat` VALUES ('1A',0,'AUI22'),('1A',0,'AUI33'),('1A',0,'AUI44'),('1B',0,'AUI22'),('1B',0,'AUI33'),('1B',0,'AUI44'),('1C',0,'AUI22'),('1C',0,'AUI33'),('1C',0,'AUI44'),('1D',0,'AUI22'),('1D',0,'AUI33'),('1D',0,'AUI44'),('2A',0,'AUI22'),('2A',0,'AUI33'),('2A',0,'AUI44'),('2B',0,'AUI22'),('2B',0,'AUI33'),('2B',0,'AUI44'),('2C',0,'AUI22'),('2C',0,'AUI33'),('2C',0,'AUI44'),('2D',0,'AUI22'),('2D',0,'AUI33'),('2D',0,'AUI44'),('3A',0,'AUI22'),('3A',0,'AUI33'),('3A',0,'AUI44'),('3B',0,'AUI22'),('3B',0,'AUI33'),('3B',0,'AUI44'),('3C',0,'AUI22'),('3C',0,'AUI33'),('3C',0,'AUI44'),('3D',0,'AUI22'),('3D',0,'AUI33'),('3D',0,'AUI44'),('4A',0,'AUI22'),('4A',0,'AUI33'),('4A',0,'AUI44'),('4B',0,'AUI22'),('4B',0,'AUI33'),('4B',0,'AUI44'),('4C',0,'AUI22'),('4C',0,'AUI33'),('4C',0,'AUI44'),('4D',0,'AUI22'),('4D',0,'AUI33'),('4D',0,'AUI44'),('5A',0,'AUI22'),('5A',0,'AUI33'),('5A',0,'AUI44'),('5B',0,'AUI22'),('5B',0,'AUI33'),('5B',0,'AUI44'),('5C',0,'AUI22'),('5C',0,'AUI33'),('5C',0,'AUI44'),('5D',0,'AUI22'),('5D',0,'AUI33'),('5D',0,'AUI44');
UNLOCK TABLES;

MYSQL Workbench
L AUIS Airlines Reservation System
Local instance MySQLB0 x
Eile Edt Vjew Query Database Server Iools Scripting Help
Flights: AU122 London to Melbourne-
Navigator
fight
seat
t
SCHEMAS
a Fiter objects
1. SELECT • FROM airli
airlinereservationdb
Tables
E flight
E
Views
sest
Stored Procedures
Functions
booksdb
Result Grid O Fiher Rowe
10
20
3D
4D
60
sys
s_number s_reserved f_code
1
AU122
1A
AU33
1C
20
30
4C
5C
1A
AU144
18
AUI22
1B
AU33
18
AU144
Administration Schemas
iC
AUI22
AU33
18
28
3B
4B
58
Information
10
10
AUJ44
1D
AU22
No object selected
1A
2A
3A
4A
SA
1D
AU33
10
AU144
2A
AUI22
2A
AU33
2A
AUJ44
28
1
AUI22
28
AU33
28
AU144
20
AUI22
20
20
AU33
AUJ44
seat 3 x
1:52 /3:30
Output
Transcribed Image Text:MYSQL Workbench L AUIS Airlines Reservation System Local instance MySQLB0 x Eile Edt Vjew Query Database Server Iools Scripting Help Flights: AU122 London to Melbourne- Navigator fight seat t SCHEMAS a Fiter objects 1. SELECT • FROM airli airlinereservationdb Tables E flight E Views sest Stored Procedures Functions booksdb Result Grid O Fiher Rowe 10 20 3D 4D 60 sys s_number s_reserved f_code 1 AU122 1A AU33 1C 20 30 4C 5C 1A AU144 18 AUI22 1B AU33 18 AU144 Administration Schemas iC AUI22 AU33 18 28 3B 4B 58 Information 10 10 AUJ44 1D AU22 No object selected 1A 2A 3A 4A SA 1D AU33 10 AU144 2A AUI22 2A AU33 2A AUJ44 28 1 AUI22 28 AU33 28 AU144 20 AUI22 20 20 AU33 AUJ44 seat 3 x 1:52 /3:30 Output
MYSQL Workbench
Local instance MySQLBO x
File Edit View Query Database Server Tools Scripting Help
日国国国 回和
flight
O B7 I gO SO O Limt to 1000 rows
1• SELECT • FROM airlinereservationdb.seat;
Navigator
seat
SCHEMAS
a Fiter objects
airlinereservationdb
Tables
flight
I
seat
Views
Stored Procedures
Functions
boolsdb
|| Edt: B |Bxport/Importi a Wrap Cell Content E
Result Grid Fiter Rov
s_number s_reserved f_code
e
Edit
sys
Resut
Grid
AU122
1A
AU33
1A
AU144
1B
AU122
Form
Editor
1B
AU33
18
AU144
Administration Schemas
1C
AU122
Feld
Type
10
10
Information
AU33
AUJ44
No object selected
AUI22
1D
Query
Stat
1D
AUI33
1D
AU144
2A
AU122
2A
AUI33
Execution
Pan
2A
AU144
28
AUI22
28
AU33
28
AU144
20
AUI22
20
AU33
20
AU144
seat 1 x
1:09 / 3:30
Output
Transcribed Image Text:MYSQL Workbench Local instance MySQLBO x File Edit View Query Database Server Tools Scripting Help 日国国国 回和 flight O B7 I gO SO O Limt to 1000 rows 1• SELECT • FROM airlinereservationdb.seat; Navigator seat SCHEMAS a Fiter objects airlinereservationdb Tables flight I seat Views Stored Procedures Functions boolsdb || Edt: B |Bxport/Importi a Wrap Cell Content E Result Grid Fiter Rov s_number s_reserved f_code e Edit sys Resut Grid AU122 1A AU33 1A AU144 1B AU122 Form Editor 1B AU33 18 AU144 Administration Schemas 1C AU122 Feld Type 10 10 Information AU33 AUJ44 No object selected AUI22 1D Query Stat 1D AUI33 1D AU144 2A AU122 2A AUI33 Execution Pan 2A AU144 28 AUI22 28 AU33 28 AU144 20 AUI22 20 AU33 20 AU144 seat 1 x 1:09 / 3:30 Output
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education