A trucking company has an application to track data from their trucks regarding miles driven and fuel used each month. This information is input from a GUI and stored in a file named “trucks.txt”. The GUI has the following components.
Component Type Purpose
txtID JTextField Input for TruckID
txtMiles JTextField Input for miles driven
txtFuel JTextField Input for fuel used
btnSave JButton Click to save data to the file
The data should be saved to the file with delimiters between the fields, as shown below.
The class method saveFile() is called by the action listener to do the work. Write the code for this method. Make sure to validate that all data is present.