Java Checking the Fare from A Station to Another Station Program Code
Description
- USE ECLIPSE IDE(FILES NEEDED HAVE BEEN UPLOADED) PLEASE FOLLOW THE INSTRUCTION
- File to submit: Zip the WHOLE Eclipse project for submissionDemo video: demo_run.webm
- Files needed:
SkytrainFare.accdb
ucanaccess_drivers.zip
Question: Database Information (SkytrainFare.accdb):The database (SkytrainFare.accdb) contains one table called Stations. The table contains the following columns:- ID: AutoNumber;
- Line: Short Text representing the Skytrain lines;
- Name: Short Text representing the name of the station;
- Zone: Integer representing the zone number;
- The table contains more than 50 records. The first five records are shown below:IDLineNameZone1MillenniumVCC-Clark12MillenniumCommercial-Broadway13MillenniumRenfrew14MillenniumRupert15MillenniumGilmore2Task:You are asked to create a GUI in Java. The program can check the fare from a station to another station:
- The GUI contains 6 major components as shown in the picture below:
- Two JLists (No. 1 and No. 2) show the name and line of each station record. The records are loaded from the database everytime you run the program.
Note: If you add the JList only, there will be no scroll bars. You need to do the following to add the scroll bars in the JList:- Add JScrollPane
- Add JList in the Viewport area
- Add JScrollPane
- Three radio buttons (No. 3) allow users to select one single payment method at a time;
- Two radio buttons (No. 4) allow users to select one ticket type at a time;
- One Button (No. 5) allows users to check the fare as described below
- One Button (No. 6) allows users to clear all input.
- The windows runs as follows:
- When running the program, it loads all records from the database into the program;
- The user can select the “From” station in No.1, “To” station in No. 2, payment method in No.3 and ticket type in No. 4. A warning message will display if any one of these is not selected.
- When clicking the “Check Fare” button (No. 5), a message box will display the fare of the trip. The fare is calculated as follows:
- The basic fare is determined by the following table:
(For example, travelling from VCC-Clark (Zone #1) to Commercial-Broadway (Zone #1) is a 1-Zone fare because both stations are in the same zone;raveling from Gilmore (Zone #2) to Waterfront (Zone #1) is a 2-Zone fare; Traveling from Waterfront (Zone #1) to King George (Zone #3) is a 3-Zone fare. - In addition to above, there is an “YVR Airport AddFare”.
- An additional $5 charge is added to some trips that start at the YVR Airport, Sea Island Centre, and Templeton Canada Line stations (e.g., Templeton to Waterfront).
- No additional charge is added to those trips that end at the YVR Airport, Sea Island Centre, and Templeton Canada Line stations (e.g., Waterfront to Templeton).
- The whole ticket is free to those tips that start and end at the YVR Airport, Sea Island Centre, and Templeton Canada Line stations (e.g., YVR Airport to Templeton or Templeton to YVR Airport).
- The basic fare is determined by the following table:
- The message box must contain the following information:
- The ticket type selected
- The payment method selected
- The “From” and “To” stations
- The fare price
- When clicking the “Reset” button (No. 6), the two JList and two set of radio buttons will be deselected. (Hints: there is a method called “clearSelection()” for JList and ButtonGroup.)
- Additional Requirement:
- You MUST use the same type of components as described above;
- The GUI should be as close to the one in the sample video as possible;
- You MUST create Enumeration called Line. It contains the following values: Millennium, Expo, Canada
- You MUST use the Enumeration Line to represent the skytrain line of a station throughout the program;
- You MUST create one class called Station to store each record in the database;
- Enabling/Disabling the Concession RadioButton is optional.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."