Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Lab Java Swing Question 4 Write a Java GUI application to calculate a taxi fare based on two modes: Calculate by distance (kilometer) to
Java Lab Java Swing
Question 4 Write a Java GUI application to calculate a taxi fare based on two modes: Calculate by distance (kilometer) to the destination - the rate is RM0.95 per kilometer. Calculate by duration (minutes) to the destination - the rate is RM0.35 per minutes. User will make a selection from the radio buttons (either one) and key-in the related data in the respective text field. Once user presses "Enter" from the keyboard, program will display the chosen mode and the estimation fare in the respective text fields (as shown on the sample output). Use Decimal Format class to format the answer into two-decimal point. Other descriptions are as follows: Font 1: Dialog, Bold and Italic, size 30 Font 2: Arial, Bold, size 15 Panel 1 is shaded with green. Panel 2 is shaded with light grey. Panel 3 is shaded with white, Icon image file: taxicar.jpg Texts in text field 3 and 4 are red. Refer to Figure Q2a for details layout. Refer to Figure Q26, Q2c, and Q2d for the sample output screens. Panel 1: Located at the NORTH of the frame Label 1 "Welcome to MyTeksi Sapu". Font 1 Panel Subpanel 2 2 2 Grid Layout (3.3) Label 2: Font 1 Radio Label 3 Text field button 1 1 Radia Label 4 Text field button 2 2 Label with image Labels Text field 3; Font 2 Label 6 Text field 4; Font 2 Panel 3 Subpanel 3: GridLayout (2.21 Figure 2a: The frame layout Panel 2: Grid Layout (2,1). Located at the CENTER of the frame Panel 3: GridLayout 2,2), Located at the EAST of the frame 4 My Teksisapu X Welcome to MyTeksiSapu TAXI Calculate fee by : Kilometer (RM0.95 per km) Distance to destination(km): Calculated by Time (RM0.35 per/min) Duration to destination(mins): Total: RM Figure Q4b: Sample output 1 (default) My Teksi Sapu Welcome to My TeksiSapu TAXI Calculate fee by : e kilometer (RM0.95 perkm) Distance to destination(km): Calculated by: Meter Time (RM0.35 per min) Duration to destination(mins): Total: RM 33.25 Figure Q4c: Sample output 2 (User selection by distance) My Teksisapu Welcome to MyTeksiSapu TAXI Calculate fee by : Kilometer (RM0.95 per km Distance to destination(km) Calculated by Time a Time (RM0.35 perimin Duration to destinationimins): 50 Total: RM 17.50 Figure Q4d: Sample output 3 (User selection by time) 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started