Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Subject: computational financing 9.2 Recapitulation Consider the following C++ c

ID: 3714950 • Letter: S

Question

Subject: computational financing

9.2 Recapitulation Consider the following C++ code, to calculate the fair values of: (i) American put, (ii) European put, (iii) American call, iv) European call . There are totally 8000 function calls and the memory allocation is the same for them all . Complete the code below and run it. Show me your completed code double S-0; double K 100 , 0 ; doubler-0.05 double q = 0.01; double sigma - 0.5; double T-1.0 double to 0.0 double FV-An-put 0; double FV_Eur_put - 0; double FV_Am_call- 0; double FV-Eur-call = 0 int n = 100; double dS - 0.1; int imax = 2000; for (int i = 1; í

Explanation / Answer

Actually I need you to specify what code to implement in binomial_simple function

#include<iostream.h>

#include<conio.h>

#include<fstream.h>

#include<iomanip.h>

double binomial_simple(double St,double Kt,double rt,double qt,double sigmat,double Tt,double t0t,boolean false,boolean false,int nt,double FVt)

{

double ans;

return ans;

}

void main()

{

ofstream outfile;

outfile.open("cheggQue.txt");

double S=0;

double K=100.0;

double r = 0.05;

double q = 0.01;

double sigma = 0.5;

double T = 0.1;

double t0 = 0.0;

double FV_Am_put = 0;

double FV_Eur_put = 0;

double FV_Am_call = 0;

double FV_Eur_call = 0;

int n = 100;

double dS = 0.1;

int imax = 2000;

boolean b1=true;

boolean b2=false;

for(int i=1;i<=imax;++i)

{

S = i*dS;

binomial_simple(S,K,r,q,sigma,T,t0,b2,b1,n,FV_Am_put);

binomial_simple(S,K,r,q,sigma,T,t0,b2,b2,n,FV_Eur_put);

binomial_simple(S,K,r,q,sigma,T,t0,b1,b1,n,FV_Am_call);

binomial_simple(S,K,r,q,sigma,T,t0,b1,b1,n,FV_Eur_call);

outfile<<setw(16)<<S<<" ";

outfile<<setw(16)<<FV_Am_put<<" ";

outfile<<setw(16)<<FV_Eur_put<<" ";

outfile<<setw(16)<<FV_Am_call<<" ";

outfile<<setw(16)<<FV_Eur_call<<" ";

}

getch();

}