Starting from:
$35

$29

Programming Assignment #2 Solution

Assignment 2, Tree in Finance




Tree can be used to model changes to the economic environment or changes to the asset price. For example, in the tree representation below, X axis indicates time from now to the future, while Y axis indicates movement of stock prices in the future.




In the simple example of a binomial tree below, starting at the root node at time zero, we can use the up-node to represent a stock price move up and we can use the down-node to represent a stock price move down.










Finance professionals often use probability to model possible future behavior. For example, a stock has 60 percent chance that price moves up has 40 percent chance that the price moves down. In order to model 60 percent chance of price movement up, random function with values 0 to 1 is used. If a random value is between 0 and .60, the stock price moves up. If random a value is between .60 and 1, the stock price moves down.






The assignment is




 
Create a factory class that builds a binomial tree given two parameters




 
T in integer to indicate the number of time periods. This is the depth or the length of the tree. The width the height of the tree at the time period T is 2**T.




 
P in integer between 0 and 100 to indicate the probability of up price movement. The probability of down price movement is 100-P.




Note: The factory needs to be implemented as public final class with a static method. Refer to the following as an example.




public final class BinaomialTreeFactory {




public static Node create(int T, int P) {




}




}







 
Create a navigator with one parameter N, for the number of iterations. For each iteration:




 
Starting from the root node, time zero, call the random function. If the number is between 0 and P, traverse to up-node for the next time period. If the number is between P and 100, traverse to down-node for the next time period.




 
Repeat step a, until the time T is reached.




 
While traversing the binomial tree, print Time Period, value generated by the random function, and the movement (UP or DOWN)




In a later assignment, we can use a different navigation to price an Option.




Requirements




The grading will be different than the first assignment, and will be as follows.




5: Perfect







4: Trivial/Cosmetic Mistake OR Fully Working Functionality







3: Multiple Trivial Mistakes OR Mostly Working Functionality







2: Significant Mistakes OR Missing Significant Functionality







1: Attempted







0: No Attempt







Submission




You are to hand in your development by Wednesday, February 20th 18:00 P.M.. Once you have done all your work, email me your zipped project file or Java source file(s). Your work will be counted about 10% of your final grade. You can submit your work by Friday, February 18:00 P.M. (with 25% score deduction).





More products