Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

Can we observe mental processes as well as brain structure?

Answered: 1 week ago