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

Difference between object state and behavior, What is difference between ob...

What is difference between object state and behavior? Ans) If you change the state of an object, you ask it to perform a behavior. An object kept its states in a field e.g. vari

Draw out a uml class diagram, Question: (a) Draw out a UML class diagra...

Question: (a) Draw out a UML class diagram that captures the following information: An Employee is a kind of Person. An ATM is a kind of Machine. Both an Employee and an ATM

Explain the concept of multi-threaded- java, Explain the concept of Multi-T...

Explain the concept of Multi-Threaded- JAVA Java has a concept of concurrency wired right in to the language itself. This works out more cleanly than languages where concur

Project on image processing, Project Description: Computer vision and Im...

Project Description: Computer vision and Image processing project to extract book title Skills required: Java, C Programming

Explain the 4 phases of RUP?, 1. Inception : In the mean while the inc...

1. Inception : In the mean while the inception phase, you work out the business part for the project. You also will be creating a rough cost estimate and return on investment.

How to write exception subclasses, How to Write Exception Subclasses ? ...

How to Write Exception Subclasses ? Most exception subclasses inherit all their functionality from the superclass. Each subclass majorly serves as a marker for a various types

Simple Tasks, Use a FOR loop and give me the largest number divisible by 7 ...

Use a FOR loop and give me the largest number divisible by 7 11 13 17 use the number from 1 to 10000 (or even 100000)

What is jdbc exactly, What is JDBC exactly? Describe the steps required to ...

What is JDBC exactly? Describe the steps required to execute a SQL query using JDBC.

Differentiate uni-processor os from multi-processor os, Differentiate uni-P...

Differentiate uni-Processor OS from Multi-Processor OS? Uni-processor OS : Uni-processor OS'es is designed to schedule tasks on a single uPs just whereas Multiprocessor O

What is the basic difference between threads and processes? , A process is ...

A process is an execution of a code but a thread is a single execution sequence within the process. A process may contain multiple threads. A thread is sometimes named a lightweigh

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