insurance company, you have installed trackers into several of your customers’ cars to monitor their driving and offer a discount bonus if they are ‘good’ drivers.  The data collected show the average acceleration per trip for the last ten trips for five sample drivers. The rules state that if the total average acceleration for the past ten trips is more than 5 metres per second per second OR any trip has an average of 6 metres per second per second or more, then no discount should be applied to the customer.  The collected data are shown below and captured in a two-dimensional array called acceleration. Write a C function called bonusCheck that takes the

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question

WRITTEN IN C

 

You work in an insurance company, you have installed trackers into several of your customers’ cars to monitor their driving and offer a discount bonus if they are ‘good’ drivers.  The data collected show the average acceleration per trip for the last ten trips for five sample drivers.

The rules state that if the total average acceleration for the past ten trips is more than 5 metres per second per second OR any trip has an average of 6 metres per second per second or more, then no discount should be applied to the customer. 

The collected data are shown below and captured in a two-dimensional array called acceleration.

Write a C function called bonusCheck that takes the 2D array and the driver number (their index in the array of acceleration data eg. Driver 1 = {2, 2, 2, 3, 4, 4, 3, 3, 3, 2}) as parameters and returns 1 to apply bonus and 0 for no bonus. 

 

For example:

Test Result
int acceleration [5][10] = {{3, 1, 3, 4, 6, 7, 3, 2, 5, 3},{2, 2, 2, 3, 4, 4, 3, 3, 3, 2},{5, 6, 7, 6, 5, 3, 3, 3, 3, 3},{3, 3, 3, 3, 4, 4, 3, 2, 1, 3},{2, 3, 4, 6, 6, 2, 5, 1, 3, 3}}; printf("%d", bonusCheck(acceleration,1)); 1
int acceleration [5][10] = {{3, 1, 3, 4, 6, 7, 3, 2, 5, 3},{2, 2, 2, 3, 4, 4, 3, 3, 3, 2},{5, 6, 7, 6, 5, 3, 3, 3, 3, 3},{3, 3, 3, 3, 4, 4, 3, 2, 1, 3},{2, 3, 4, 6, 6, 2, 5, 1, 3, 3}}; printf("%d", bonusCheck(acceleration,2)); 0
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr