Question: Instructions The program in Example 8 - 7 outputs the average speed over the intervals of length 1 0 . Modify the program so that

Instructions
The program in Example 8-7 outputs the average speed over the intervals of length 10. Modify the program so that the user can store the distance traveled at the desired times, such as times 0,10,16,20,30,38, and 45. The program then computes and outputs the average speed of the object over the successive time intervals specified by the time when the distance was recorded. For example, for the previous list of times, the average speed is computed over the time intervals 0 to 10,16 to 20,20 to 30,30 to 38, and 38 to 45.
Instructions for Example 8-7 have been included for your convenience.
Example 8-7
Suppose that the distance traveled by an object at time t = a1 is d1 and at time t = a2 is d2, where a1< a2. Then the average speed of the object from time a1 to a2, that is, over the interval [a1, a2] is (d2- d1)(a2- a1). Suppose that the distance traveled by an object at certain times is given by the following table:
Time Distance
00
1018
2027
3038
4052
5064
Then the average speed over the interval [0,10] is (18-0)/(10-0)=1.8, over the interval [10,20] is (27-18)/(20-10)=0.9, and so on.
An example of the program is shown below:
Enter time and the distance traveled at that time 0
0
Enter time and the distance traveled at that time 10
18
Enter time and the distance traveled at that time 20
27
Enter time and the distance traveled at that time 30
38
Enter time and the distance traveled at that time 40
52
Enter time and the distance traveled at that time 50
64
00.00
1018.00
2027.00
3038.00
4052.00
5064.00
Time Distance Traveled Average Speed / Time Interval
00.000[0,0]
1018.001.80[0,10]
2027.000.90[10,20]
3038.001.10[20,30]
4052.001.40[30,40]
5064.001.20[40,50]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!