Question: Please don't forget to give the yield function and the main function to execute the program. Thanks 6 Question 6 6.1 Up to now, all

 Please don't forget to give the yield function and the mainPlease don't forget to give the yield function and the main function to execute the program. Thanks
function to execute the program. Thanks 6 Question 6 6.1 Up to
now, all the functions we have written are stand-alone funins, Hence both

6 Question 6 6.1 Up to now, all the functions we have written are stand-alone funins, Hence both the functions price.from yieldd...) and yield.from-price... carry cumbersome baggage, in the sense of input arguments (F.c,n) for the face, coupon and number of coupons, respectively. The valaes of these parameters are not relevant to a bisection algorithm, and do not change during iteration. Nevertheless, they must be passed as inputs to yield from price(...), sothat they can be passed to price.from.yield(...) to value the bond 6.2 This suggests the use of object-oriented programming. We can encapsulate the values of (Fe,) in "Bond" object. The functions price-from-yield( ) and yield-from-Price ( ) can be methods of that Bond class. We shall also support bonds which are notnewly issued, so to 0 6.3 Let us design a simple Bond class. What are its internal data members? Clearly we must have the face. We also need the maturity. (In real life the maturity would be a date, but here we store it as a double, measured in years.) To make things more interesting, let us consider a bond with variable coupons G, paid on dates (ti nes) t., i = 1.2 ,n. Both c' and t, are of type double. Hence our data members are: 1. double face; 2. double maturity 3. std; : vector coupon ; You can also include a data member of type int to store the namber of coupons, if you wish 6.4 Because the coupons are variable, and also to 0, the fornmula for the bond price B in terms of the yield y is more complicated: Here T is the maturity date. In all test examples of coupon bearing bonds, the last coupon date n will be eual to T . Howerer, the Bond class must also work for a ZERO COUPON BOND The Bond class must function even if there are no coupons eand dates t.. Hence we cannot assume T- t, because f might not exist

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!