-Hey, guys so I have a problem that I am trying to figure out and it goes something like this....
The car company you work for has three models of vehicles; a truck (Haullr), a sports coupe (Quikk) and a compact car (Meep). One of the company goals is to make the vehicles you sell more fuel efficient.
You are given a text file; "fuel_economy_in.txt" with the following format:
Haullr 15.5 10%
Quikk 24.5 5%
Meep 32.3 4%
Each line consists of the model name, its present fuel economy, and the expected increase in fuel economy.
Write a program that reads data from the text file, and outputs a new text file (fuel_economy_out.txt) that reflects the NEW fuel economy based upon the expected increase, formatted to two decimal places.The output should look something like this:
Haullr 17.05
Quikk 25.73
Meep: 33.59
-I am very confused about how to go about this. If you guys can give me some assistance that would be great.
open file a for read
open file b for write
while (read line from file a)
{
extract model, fuel economy and expected increase from the line
compute new fuel economy
write model, new fuel economy to file b
}
close file a
close file b