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

Javacard, I want to know if you can help me with a javacard programming pro...

I want to know if you can help me with a javacard programming project

Differentiation between a vector and an array, Differentiation between a V...

Differentiation between a Vector and an array . Explain in Brief about the pros and cons of both?

Explain all java primitive data types, Explain all Java Primitive Data Type...

Explain all Java Primitive Data Types? boolean 1-bit. May take on the values true and false only. true and false are describe constants of the language and are not the s

Describe what is bytecode, Describe what is bytecode? It is an inst...

Describe what is bytecode? It is an instruction set. It extends with class. 'javac' compiler translates the .java file into .class. JVM interprets bytecode.

Student, short Java application that stores words in an Array or ArrayList....

short Java application that stores words in an Array or ArrayList.

Is java is network oriented or not, Distributed / Network Oriented Java...

Distributed / Network Oriented Java is network friendly -- both in its portable, threaded nature, and since common networking operations are built-in to the Java libraries.

What are separators in java, What are separators in java? Separators he...

What are separators in java? Separators help elaborates the structure of a program. The separators used within HelloWorld are parentheses, ( ) , braces, { } , the period, .

Develop a custom android app, Develop a Custom Android App Project Descr...

Develop a Custom Android App Project Description: We want you to construct a custom Android app. Once user downloads the app and upon installation the user gets push notif

What are the components of struts, Struts components can be classify into M...

Struts components can be classify into Model, View and Controller: ? Model: Components like business logic /business processes and data are the type of model. ? View: HTML, J

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