Question
Write theThe program will create an instance of FuelTracker for each fuel type, passing in fuel type, maximum amount and current amount. 2. You will
Write theThe program will create an instance of FuelTracker for each fuel type, passing in fuel type, maximum amount and current amount.
2. You will be reading data from input file GasSales.txt. Open the file and look at the data before you have your application read the file. File format is as follows.
o The first 4 lines in input file GasSales.txt are the maximum amounts and current amounts for each fuel type. Read the first 4 lines and set the maximum amount and current amount in the right FuelTracker instance.
o For the rest of the file (lines 5 to the end), each line has 2 tokens: first is fuel type and the second token is amount of fuel sold.
3. Read the rest of the file, subtracting the amounts from the current amount of the right FuelTracker instance. Use the first token, which is the fuel type to determine which FuelTracker instance to update.
4. When all the records have been read, display the information for each instance of FuelTracker
Run and test your program. Correct any errors. Once your program is corrected, zip FuelTracker.java and your FuelTrackerTester.java, and submit the zipped folder to Web Submit.
GasSales.txt:
P 2000 1878.222 R 2000 201.999 S 2000 1212.232 D 3000 1210.023 D 1199.234 P 25.443 P 10.501 S 14.344 R 18.232 D 125.111 D 10.345 R 8.561 R 15.234 R 5.76 S 12.222 S 17.224 R 11.222 R 15.565 R 15.378 R 14.788 D 110.218 D 137.909 D 132.870 D 98.34
Step 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