question archive Write a C# program that calculates and displays the amount of money available in a bank account that initially has $1,000 deposited in it and that earns 8 percent interest a year

Write a C# program that calculates and displays the amount of money available in a bank account that initially has $1,000 deposited in it and that earns 8 percent interest a year

Subject:Computer SciencePrice:3.86 Bought7

Write a C# program that calculates and displays the amount of money available in a bank account that initially has $1,000 deposited in it and that earns 8 percent interest a year. Your program should display the amount available at the end of each year for a period of ten years. Use the relationship that the money available at the end of each year equals the amount of money in the account at the start of the year plus .08 times the amount available at the start of the year.

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

using System;

namespace MyApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            float balance = 1000;
            float years = 0;
            while (years<10) 
            {
                years++;
                float interest = balance * (float)0.08;
                balance = balance + interest;
                Console.WriteLine("{0}\t${1}", years, balance);
            }    
        }
    }
}

Output

1 $1080

2 $1166.4

3 $1259.712

4 $1360.489

5 $1469.328

6 $1586.874

7 $1713.824

8 $1850.93

9 $1999.005

10 $2158.925