## Part (a): ## barrels_produced = c(80, 70, 50, 30, 10) print(sum(barrels_produced)) gross_revenue = 20*barrels_produced net_income = c(1200, 1000, 500, 200, 50) option_1 = pmin(0.22 * gross_revenue, 0.5 * net_income) option_2 = 5 * barrels_produced depletion_allowance = pmax(option_1, option_2) taxable_income = net_income - depletion_allowance tax = 0.45 * taxable_income after_tax_income = net_income - tax T = data.frame(BP=barrels_produced, GR=gross_revenue, NI=net_income, Option_1=option_1, Option_2=option_2, DA=depletion_allowance, TI=taxable_income, tax, ATI=after_tax_income) print(T) print(sum(T$DA) ) ## Part (b): ## r= 0.2 PV = -1000 + sum( after_tax_income *((1+r)^(-seq(1, 5)) )) print(sprintf('PV= %f', PV)) cs = polyroot( c(-1000, after_tax_income) ) rs = 1/cs - 1 print(rs)