Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to solve this in JAVA visual programming Problem: In this exam, we aim to implement a train management system. We have two actors: -

How to solve this in JAVA "visual programming"

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 actors: - Admin: responsible for adding the trains to the system - User: able to search for a train and make a reservation through the system; All the trains 'data will be stored in a file. It contains all the trains as Train Objects. In follow, we will explain the different GUIs of our system. 1. Login GUI: - If the admin login does not exsit in the database or the password is wrong, the system shows the following message : - The "Enter" button opens the page "Add Train" for the admin or the "Search 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.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): After the authentification, the user can make search for a train and make a reservation. First of all the following GUI will appear to the user: - The user should enter two different stations: departure and arrival; also he 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. - 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 with AI-Powered 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

Students also viewed these Databases questions