Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I solve this question in Java? Problem: In this exam, we aim to implement a train management system. We have two actor: -

How do I solve this question in Java? image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Problem: In this exam, we aim to implement a train management system. We have two actor: - Admain: responsible for adding the trains to the system. - User; able to search for a traia and make a reservation through the sysiem; All the trains 'data will be stored in a flec. It contains all the trains as Train Objects. In follow, we will explain the different GUIs of our system. 1. Login GUL: - If the admin login does not exsil in the database or the password is wrong. the system shows the following message: Input Enror x X. Check your login and password - The "Enter" button opens the page "Add Train" for the admin or the "Seanch Train" for the user. - The "Cancel" button cleans the JTextField and the JPasswordField. 2. The class Train: Implement the class Train implementing Serializable. All the Objects of this class will be stored in the file "Train. xd ". 3. The class Admin: The "Add Train" GUI is described as follows: 2. The class Train: Implement the class Train implementing Serializable. All the Objects of this class will be stored in the file "Train.txt". 3. The class Admin: The "Add Train" GUI is described as follows: In order to add a train to the "Train.txt" file, the admin needs to enter an id. The id is unique, so before adding the train we need to check if there is no other train in the file with the same id. The Admin should choose two different stations and define the maximum number of passengers that could take the train. Otherwise, if the departure station and the arrival station are equal or the "Max Passengers" is not specified, the following message will appear: If all the inputs fields are well and correctly given, an Object Train will be added to the file and a message will appear by the system. 4. User (Search Train): the authentification, search for a train make a reservation. First all the following GUI II sppear to the ush. - The user should enter two different stations: departure and arrival; also be should define the number of passengers; - If the inputs are empty of the stations are equals the system will show the following message: - When the user press the button "search" the system will open the file and try to find a train with the same defined departure and arrival stations and with a "max Passengers" greater than the "number of passenger" requested by the user. - When the user press the button "search" the system will open the file and try to find a train with the same defined departure and arrival stations and with a "max Passengers" greater than the "number of passenger" requested by the user. - You should check if the user input exists in the File. If the search is failed the System will show the following message: If a train is found, the system will show a new GUI for the reservation. 5. User (Reservation): - When the user makes a successful search, the system will show a new GUI with all the details of the corresponding train. All the fields will be disabled for editing. - The following figure shows an example: - When the user presses the button "Confirm", the system will reserve the defined "number of Passengers" from the "Max Passengers" (The number of Max. Passers will be decreased by the number of passers given by the user), and a confirmation message will appear

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions