Question: For each problem you must perform the following: 1. Develop both the java Imperative and Functional (Lambda Expression) program solutions. These files should be titled
For each problem you must perform the following:
1. Develop both the java Imperative and Functional (Lambda Expression) program solutions. These files should be titled Prob_X_Imperative.java and Prob_X_Functional.java. X stands for the Problem number.
2. You are to develop and get them running in Eclipse.
a. Code.
i. You need to create each problem as a main program - the code is in the body of the program. You may create a method that does the computations called from the main method - please only one class each for Imperative and Functional solution (a total of 2 classes).
b. Approach. Both solutions (Imperative and Functional ) need to be recursive.
i. Functional approach
1. For the Functional program you should consider using the UnaryOperator interface in Java to declare its type.
2. Function definitions will come before the main program (for readability). They will need to be static.
3. Since you are using a recursive call on a static function you will need to preface the recursive call with the class name.
4. The method .apply may be useful to you here also to pass the parameter(s) to the function.
1. Problem 1
a. Implement a function that computes the factorial for the given Integer input.
b. Print out the first 16 factorial numbers (0 to 15 inclusive). Use a for loop in the main method to do this.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
