Develop a program that accepts a deposit amount and period of deposit. Calculate the maturity amount after the period of deposit. The bank pays 4% interest per year for any deposits made in the bank.
1
Expert's answer
2014-08-08T13:08:55-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace maturity_amount { class Program { /// <summary> /// Main method /// </summary> /// <param name="args"></param> static void Main(string[] args) { //variable for deposit Amount double depositAmount; //variable for period int period; //variable for maturity Amount double maturityAmount=0; //promt user to enter deposit amount Console.Write("Enter deposit amount: "); //read deposit amount depositAmount = double.Parse(Console.ReadLine()); //promt user to enter period of deposit Console.Write("Enter period of deposit (in year): "); //read period of deposit period = int.Parse(Console.ReadLine()); maturityAmount = depositAmount; //calculate maturityAmount for (int i = 0; i < period; i++) { maturityAmount += maturityAmount*0.04; } //show result Console.Write("Maturity amount after the period of deposit: $" + maturityAmount.ToString()); //delay Console.ReadLine();
Comments
Leave a comment