Question #185423

an online bank wants you to create a program that shows prospective customers how their deposits with grow. Your program should read the intial balance and the annual interest rate. interest is compounded monthly .display the balances after the first three months



Expert's answer

Module Module1


    Sub Main()
        'Read the intial balance and the annual interest rate
        Console.Write("Enter the initial balance: ")
        Dim initialBalance As Double = Double.Parse(Console.ReadLine())
        Console.Write("Enter the annual interest rate: ")
        Dim annualInterestRate As Double = Double.Parse(Console.ReadLine())
        Dim monthlyInterest As Double = (annualInterestRate / 100.0) / 12.0
        'Dim currentBalance As Double = initialBalance + (initialBalance * monthlyInterest)
        'Display the balances after the first three months
        Dim balance As Double = initialBalance + (initialBalance * monthlyInterest)
        Console.WriteLine("Your balance after 1 month: " + balance.ToString("C"))
        For month As Integer = 2 To 3
            balance += (balance * monthlyInterest)
            Console.WriteLine("Your balance after " + month.ToString() + " month: " + balance.ToString("C"))
        Next
        Console.ReadLine()
    End Sub


End Module

LATEST TUTORIALS
APPROVED BY CLIENTS