Question

Use the switch structure to write a MATLAB program to compute the amount of money that...



Use the switch structure to write a MATLAB program to compute the amount of money that accumulates in a savings account in one year. The program should accept the following input: the initial amount of money deposited in the account; the frequency of interest compounding (monthly, quarterly, semiannually, or annually); and the interest rate. Run your program for a $10000 initial deposit for each case; use a 4 percent interest rate. Compare the amounts of money that accumulate for each case.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The given Matlab code should work well for you. Let me know if you have any doubt regarding the code.

The formula used is a basic compound interest formula for one year.

function amount = CompundInteres(initial, rate, frequency)
    switch frequency
        case 'monthly'
            amount = initial*(1 + rate/1200)^12;
        case 'quarterly'
            amount = initial*(1 + rate/400)^4;
        case 'semiannually'
            amount = initial*(1 + rate/200)^2;
        case 'annually'
            amount = initial*(1+rate/100);
        otherwise
            fprintf("Not a valid frequency");
            return;
    end
  
end

CompundInteres(10000, 4, 'monthly') %10407
CompundInteres(10000, 4, 'quarterly') %10406
CompundInteres(10000, 4, 'semiannually') %10404
CompundInteres(10000, 4, 'annually') %10400

Add a comment
Know the answer?
Add Answer to:
Use the switch structure to write a MATLAB program to compute the amount of money that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Determine the amount of money in a savings account at the end of 7 years, given...

    Determine the amount of money in a savings account at the end of 7 years, given an initial deposit of $13,500 and a 4% annual interest rate when interest is compounded: Use Appendix A for an approximate answer, but calculate your final answer using the formula and financial calculator methods. A. Annually: ? B. Semiannually: ? C. Quarterly: ?

  • Determine the amount of money in a savings account at the end of 10 years, given...

    Determine the amount of money in a savings account at the end of 10 years, given an initial deposit of $5,500 and a 12 percent annual interest rate when interest is compounded (a) annually, (b) semiannually, and (c) quarterly. Include financial calculator steps, including the keys pressed on the calculator to solve each step of the question.

  • (11) An account with an annual interest rate of 3% is opened and some amount of money is deposite...

    (11) An account with an annual interest rate of 3% is opened and some amount of money is deposited today. Assuming no Further transactions (withdrawals or deposits) on the account, how much should the initial deposit be so that the account has $500 16 months from now if interest is compounded (a) annually? (2 points) (b) monthly? (2 points) (c) quarterly? (4 points) (d) continuously? (2 points) Also, provide the ANNUAL yield in all parts. (11) An account with an...

  • Determine the amount of money in a savings account at the end of 10 years, given...

    Determine the amount of money in a savings account at the end of 10 years, given an initial deposit of $5,500 and a 12 percent annual interest rate when interest is compounded: (Do not round intermediate calculations. Round your final answers to 2 decimal places.) Future Value a. Annually b. Semiannually c. Quarterly

  • Determine the amount of money in a savings account at the end of 3 years, given...

    Determine the amount of money in a savings account at the end of 3 years, given an initial deposit of $4,000 and a 4 percent annual interest rate when interest is compounded: Use Appendix A for an approximate answer, but calculate your final answer using the formula and financial calculator methods. (Do not round intermediate calculations. Round your final answers to 2 decimal places.) a, annually b. semiannually c. quarterly

  • How much money should be deposited today in an account that earns 5% compounded semiannually so...

    How much money should be deposited today in an account that earns 5% compounded semiannually so that it will accumulate to $8000 in three years? The amount of money that should be deposited is $ (Round up to the nearest cent.) You deposit $14,000 in an account that pays 5% interest compounded quarterly A. Find the future value after one year B. Use the future value formula for simple interest to determine the effective annual yield. A. The future value...

  • Write a program that calculates the amount of money that you must invest In a savings...

    Write a program that calculates the amount of money that you must invest In a savings account at a given interest rate for a given number of years to have a certain dollar amount at me end of the period Y our program will ask the user for the amount the user wants to have at the end of the term (future value). the number of years the user plans to let the money stay in the account, and the...

  • The following situations require the application of the time value of money: Use the appropriate present...

    The following situations require the application of the time value of money: Use the appropriate present or future value table: FV of $1, PV of $1, FV of Annuity of $1 and PV of Annuity of $1 1. On January 1, 2017, $16,000 is deposited. Assuming an 8% interest rate, calculate the amount accumulated on January 1, 2022, if interest is compounded (a) annually, (b) semiannually, and (c) quarterly. Round your answers to the nearest dollar. Future Value a. Annual...

  • Numerical Methods (matlab code) QUESTION 2 A friend wants to deposit $2000 into a savings account....

    Numerical Methods (matlab code) QUESTION 2 A friend wants to deposit $2000 into a savings account. She goes to two banks and is offered competing interest rates for the account. Bank 1 has a 10% interest rate, and compounds once annually. Bank 2 has an 9% interest rate, but compounds monthly. Use the following annually compounded interest formula, A= P(1+r) where A is the accumulated amount, P is the principal amount deposited, r is the annual interest rate (as a...

  • P5.3      Present Value. Suppose you want to deposit a certain amount of money into a savings...

    P5.3      Present Value. Suppose you want to deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today tomake that happen? You can use the following formula, which is known as the present value formula, to find out: P = F/(1+r)^n The terms in the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT