Question: Use Haskell coding language to resolve 3. compoundInterest Task: Compute the compound interest earned. compoundinterest::Floatingaaprincipala-rateInt-numofcompoundingperiods Compound interest is the interest earned from some quantity over

Use Haskell coding language to resolve

Use Haskell coding language to resolve 3. compoundInterest Task: Compute the compound

3. compoundInterest Task: Compute the compound interest earned. compoundinterest::Floatingaaprincipala-rateInt-numofcompoundingperiods Compound interest is the interest earned from some quantity over multiple "compounding periods", where for each period the amount of interest is based on the original quantity (the principal) and on accumulated interest from all previous periods. E.g.r given a principal of 100 and a rate of 20%, the first period earns us 1000.2=20. In the second period we earn (100+20)0.2=24, for a total accumulated interest of 20+24=44. In the third period we earn (100+44)0.2=28.8, for a total accumulated interest of 44+28.8=72.8 While there are formulae that will let you directly compute the amount of compound interest given the other parameters, we strongly encourage you to implement this function using recursion -- it's good practice! Examples: 4. collatzLen Task: Compute the length of the Collatz sequence starting at the input. collatzLen::IntegerstartvalueofthesequenceInteger The Collatz conjecture has to do with the sequence starting with any positive integer n, where each subsequent term in the sequence is defined by applying the function C to the preceding term, where: C(n)={n/23n+1ifnisevenifnisodd The conjecture states that all Collatz sequences eventually end in 1. E.g., if we start with n=10, we step through the subsequent values 5,16,8,4,2,1. Your function will return the number of steps in the Collatz sequence between a starting value of n and the terminating 1 . Examples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!