Question
Melton Van Company has a file called VanInput.txt which contains the following information: Van Number (an int) Fuel Cost (a double) Equipment Insurance (a double)
Melton Van Company has a file called VanInput.txt which contains the following information: Van Number (an int) Fuel Cost (a double) Equipment Insurance (a double) Miles Driven (a int) The company pays its drivers $0.50 per mile driven. The company also pays out a bonus of $100 to the trucks driver if the driver has driven 100 miles or more in a single trip. Assume the company has up to 10 vans. Write a C++ program that does the following: Create two parallel arrays (one for the van numbers, the other for the final van costs.) Read in the data from the file. Calculate the final cost per van (including drivers bonus if applicable). Display all information to the console including driver bonus (if any) and final van cost. Store the van number and calculated final van cost in the arrays. Create an output file called VanCost.txt that contains the contents of the arrays in reverse order.
1 Example Input and Output
VaInput.txt should look like this:
111 100.00 200.00 50
222 200.00 300.00 100
333 400.00 500.00 200
Note that each line contains the van number, fuel cost, equipment cost, and miles driven in that order. The display should look like this:
This is Melton Van Company Information
Van No Fuel Equipment Miles Mileage Pay Driver Bonus Final Cost
111 100.00 200.00 50 25.00 0.00 325.00
222 200.00 300.00 100 50.00 100.00 650.00
333 400.00 500.00 200 100.00 100.00 1100.00
Totals 700.00 1000.00 350 175.00 200.00 2075.00
Note the Mileage pay is calculated by multiplying the number of miles by 0.50, and the final cost is the sum of the fuel cost, equipment cost, mileage pay, and driver bonus.
VanCost.txt should look like this:
333 1100.00
222 650.00
111 325.00
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