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

How does an exception permeate through the code, How does an exception perm...

How does an exception permeate through the code? An unhandled exception moves up the method stack in search of a matching When an exception is thrown from a code which is wrapp

Student, what are Objects and Fields in java

what are Objects and Fields in java

Computer application and program, Computer application and program. Proj...

Computer application and program. Project Description: I require a project done. It is a computer desktop application program. It is not very hard. Skills required: Any

Program design, GOALS 1.   Use abstract classes in the correct program...

GOALS 1.   Use abstract classes in the correct programming context. 2.   Evaluate and use a variety of data structures. 3.   Design, evaluate and implement efficient alg

Program on object oriented technology, This assignment is intended to write...

This assignment is intended to write a simple program in Java and to use the concept of Object Oriented Technology. Open a project named "MyProject" in NetBean. Under this proje

How do i include static files within a jsp page, Static resources should al...

Static resources should always be contained using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should al

Loops, #questiongfjnkdfn..

#questiongfjnkdfn..

Write a program to perform multiplication and division, Write a program to ...

Write a program to perform multiplication and division in java? Of course Java could also do multiplication and division. Because most keyboards don't have the times and divisi

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