Design a bond class, JAVA Programming

Assignment Help:

In the lectures, we have written programs for bond pricing in discrete time. We have also talked about the theory for bond pricing and yields in continuous time. In this exercise, you will implement a bond class with methods to go between yields and prices of arbitrary bonds.

a)  Design a bond class that can be used for general coupon bonds, making annual payments, to calculate yield to maturity (YTM) and bond prices. A continuous compounding convention for YTM calculations should be used. The bond declaration may look something like:

class bond {
public:
      bond() {}
      bond() {}
      bond(double T0,double C0, double P0,double t0);
      void set_price(double Price0);
double get_price();
      void set_YTM(double YTM0);
      double get_YTM();
      double T; 
      double t;
      double C;
      double P;
private:
      double Price;
      double YTM;
};
 
You may also wish to include additional methods and attributes. The reason why the original time to maturity, T, the current time, t, the coupon payments, C, and the principal, P, are public fields, whereas the Price and Yield to maturity are defined as private fields is that the former are general attributes of a bond and can take on arbitrary (nonnegative) values, whereas the latter two are linked: one implies the other.
 
b) Create a method that calculates the bond price, given, YTM T, t, C and P.

c) Create a method that calculates the YTM, given Price, T, t, C and P.
 
d) Write a program that uses your class to calculate the YTM for a bond and the price of another bond.


Related Discussions:- Design a bond class

I need the answer for this question as code, I earn .... Rs per month. if m...

I earn .... Rs per month. if mobile costs 20% of my earning. I will buy in cash. if costs more than 20%. I will buy in 3 months installments without interest. if costs more than 40

Illustrate jdbc, JDBC stands for Java Database Connectivity: It is an ...

JDBC stands for Java Database Connectivity: It is an API which gives easy connection to a wide range of databases. To connect to a database we have to load the appropriate dri

Boolean array, If I have a boolean array that contains 30 elements (boolean...

If I have a boolean array that contains 30 elements (boolean[] fish), how do I go about isolating every 10 elements to use for something specific? Say there are 30 types of fish s

Explain parentheses in java, Explain Parentheses in Java ? Sometimes th...

Explain Parentheses in Java ? Sometimes the default sequence of evaluation isn't what you want. For example, the formula to change a Fahrenheit temperature to a Celsius tempera

What is meant by weaving, The process of applying aspects to a target objec...

The process of applying aspects to a target object to form a new proxy object is known as Weaving. The aspects are woven into the target object at the verified join points.

Need java programmer for an assignment, Need java programmer for an assignm...

Need java programmer for an assignment "Prepare a program that will accept a sequence of file names as command-line arguments. These files will consist of ASCII text representin

Automated the claim sub-system, Automated the claim sub-system: Insur...

Automated the claim sub-system: Insurance Domain:       CIA-MI   Type                                         Development - Web-based Application Role

Difference between static and non-static variable, What is the difference b...

What is the difference between static and non-static variables? A static variable is associated with the class as a whole rather than with specific instances of a class. Non-st

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd