Problem Statement

You are given the following UML diagram of classes and a flow chart. Implement the classes as they are shown in the UML diagram, and then implement the operations shown in the flow chart as described in section Problem Details below. see image.

Problem Details

The miles per gallon (mpg) fuel burn rate for a car is a function of many different factors, one of the major being speed. In this program, you will calculate the mpg rating for a car based on its speed, its base mpg rating, and a scale factor. Assume that the mpg can be calculated as follows see image.

The data file will be given to you in Blackboard as a CSV file. It has the following format (the exact data will be different): see image.

In the file, the data above would appear as

Ford,Mustang,76,20.2,40,0.02,2.3
BMW,Cooper,90,12,40,0.01,0.3

As you can see in the flowchart, your program should follow these general steps:

1. Read car data from the data file

2. Create a Car object and add it to an array. You must use ArrayList< Car> here, since you do not know ahead of time how many cars will be in the data file.

3. Process the car, updating the remaining fuel and the mpg for the car.

a. The remaining fuel is a function of the time that the car has been traveling at the current speed, and the mpg for the car at that speed.

4. If there are more cars in the data file, continue until all cars are processed.

5. When all cars are processed, write out the data to an output file called processed_cars.txt

For the example above, the output file would contain these lines:

Make: Ford Model: Mustang Current Speed: 76 Mpg: 25.023506 Fuel: 13.214568
Make: BMW Model: Cooper Current Speed: 90 Mpg: 22.450086 Fuel: 10.797332
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.