Question: dynamic programing in c++ Assume you want to build a program to help drivers maximize their income based on the loads they carry on a

dynamic programing in c++

Assume you want to build a program to help drivers maximize their income based on the loads they carry on a daily basis. Consider that we have n days of data where each day i allows a truck to carry a load. The truck driver has two choices: a light or a heavy load. The truck driver will get paid the amount of Li in case the driver selects a light load on day i. Alternatively, the driver will get paid Hi in case of selecting a heavy load on day i. The driver cannot carry more than one load per day. Also, if the driver selects to carry a heavy load, the driver is not allowed to carry any load the day before. Your goal is to maximize the drivers income. Write the MaxDriverPay(int N, int* L, int * H) function which takes three inputs: N (1N) which represents the number of days L which represents an array of N values where each Li value represents the payment of day i in case light load is selected that day H which represents an array of N values where each Hi value represents the payment of day i in case heavy load is selected that day

Use the code below:

-----------------------------

#include using namespace std; #include "Q2.cpp"

int main(){ int L[]={1,2,1,4,5,17,3,15,10,13}; int H[]={2,5,11,110,26,20,6,25,32,31}; cout <

------------------------------------------

#include #include

int MaxDriverPay(int n, int* L, int* H)

{

}

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 Databases Questions!