Question: Do not use Jframe , hard code the program please Description Write a Java GUI program that will serve as a fuel economy calculator for
Description Write a Java GUI program that will serve as a fuel economy calculator for a trip. The program should calculate overall economy as well as i legs (up to 5) based on user-entered values for mileage and fuel usage. Empty trip legs should not be included in the calculations and all values should be computed and displayed once a Button is pressed. For this problem, assume a trip leg counts as the distance between fuel fill ndividual fuel economy ratings along individual trip There should also be RadioButtons within a ToggleGroup to switch the economy calculation between "miles per gallon" and "liters per 100 kilometers." If numbers are already entered for both mileage and fuel usage, the program should auto-convert those numbers to the appropriate units, change any appropriate labels/text, and recalculate using the already entered/converted values For instance, a single trip leg with 500 miles using 15 gallons should return a result of 33.33 mpg. Another trip leg with 380 miles using 13 gallons should return a result of 29.23 mpg. The overall mileage would be 880 miles using 28 gallons for a result of 31.42 mpg. If the user switched to L/100KM, the program should recalculate the first leg using 804.67 KM and 56.78 liters for 7.06 L/100KM. Other legs would be converted/calculated similarly The program should use appropriate UI controls, spacing, and grouping to represent each trip leg. Include some type of help system (implement with whatever controls you would like) to explain how to use the program to the user. Detailed Requirements and Notes This program should o Accept user-entered miles and fuel usage for individual legs of a trip o Calculate both that leg's mileage, and the overall mileage for the entire trip o Blank entries should not be included in the overall calculations o Assume that there is a maximum of 5 legs per trip o Have a Button that, when clicked, calculates and displays the fuel rating calculation. o There should be some Ul control to allow switching between mpg and L/100KM If values are already entered, using this UI controls should auto-covert existing values and recalculate fuel rating
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
