Question
Four data files (CAR1.DAT, CAR2.DAT, CAR3.DAT and CAR4.DAT ) are available in Blackboard in the assignment folder. Each file contains track results with the following
Four data files (CAR1.DAT, CAR2.DAT, CAR3.DAT and CAR4.DAT ) are available in Blackboard in the assignment folder. Each file contains track results with the following format:
The test vehicle number (line 1).
The test date (line 2).
The test driver (line 3).
Time, t, in seconds and distance, x, in feet (one pair of (t,x) values per line for all other lines)
Velocity can be defined as v = dx/dt and acceleration can be defined as a = dv/dt. Theses equations can be approximated by v = change in distance/change in time and a= change in velocity/change in time . For the data provided above, assume v = 0 and a = 0 at the first time value 0.0. Using the above approximations v1 = (5.5 0.0)/(0.2 0.0) = 5.5 ft/0.2 s = 27.5 ft/s and a1 =( 27.5 0.)0 / ( 0.2 0.0) = (27.5 ft/s)/0.2 s = 137.5 ft / s2 . The remaining values can be determined in a similar manner.
Program Requirements:
Write a C++ program that will accomplish the following:
The program should ask the user which data file is to be used. Read the filename as a string and open the file using a string variable. Do not use an array.
Calculate the velocity and acceleration. The output of the result should be sent to a data file. The name is specified by the user. The output includes
test vehicle number
test date
test driver
values for time, distance, velocity (ft/s) and acceleration (ft/s2) for each of the data points in the input data files ( 4 numbers per line)
send the values to a commas delimited file
open the file in Excel, graph time vs. acceleration and time vs. velocity
Test vehicle: Car #1
Test date: October 26, 2007
Driver: D. Myers
0.0 0.0
0.2 5.5
0.4 15.9
0.6 30.9
0.8 49.7
1.0 71.8
1.2 97.1
1.4 125.4
1.6 156.6
1.8 190.4
2.0 226.6
2.2 265.3
2.4 306.1
2.6 348.9
2.8 393.5
3.0 439.9
3.2 488.0
3.4 537.7
3.6 588.8
3.8 641.2
4.0 694.6
4.2 749.2
4.4 804.7
4.6 861.2
4.8 918.4
5.0 976.2
Test vehicle: Car #2
Test date: October 27, 2007
Driver: M. Snelling
0.0 0.0
0.2 6.0
0.4 17.6
0.6 34.3
0.8 55.9
1.0 81.9
1.2 111.9
1.4 145.6
1.6 182.4
1.8 222.4
2.0 265.6
2.2 311.4
2.4 359.6
2.6 409.5
2.8 460.9
3.0 513.4
3.2 566.5
3.4 619.8
3.6 672.9
3.8 725.9
4.0 778.5
4.2 831.1
4.4 883.5
4.6 935.8
4.8 988.0
5.0 1040.2
Test vehicle: Car #3
Test date: October 30, 2007
Driver: R. Maynard
0.00 0.0
0.25 0.9
0.50 3.7
0.75 9.1
1.00 18.1
1.25 31.5
1.50 50.2
1.75 74.9
2.00 106.5
2.25 145.2
2.50 191.5
2.75 246.0
3.00 307.4
3.25 374.4
3.50 445.5
3.75 518.5
4.00 592.2
4.25 665.8
4.50 739.3
4.75 812.5
5.00 885.7
Test vehicle: Car #4
Test date: November 11, 2007
Driver: D. Marsh
0.00 0.0
0.25 10.7
0.50 31.0
0.75 59.6
1.00 94.9
1.25 136.5
1.50 183.6
1.75 235.5
2.00 291.5
2.25 350.9
2.50 413.1
2.75 477.4
3.00 543.2
3.25 610.2
3.50 678.0
3.75 746.4
4.00 815.3
4.25 884.0
4.50 952.3
4.75 1020.4
5.00 1088.8
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