Ask Question

An online bank wants you to create a program that shows prospective customers how their deposits will grow. Your program should read the initial balance and the annual interest rate. Interest is compounded monthly. Print out the balances after the first three months. Here is a sample run:

Initial balance: 1000

Annual interest rate in percent: 6.0

After first month: 1005.00

After second month: 1010.03

After third month: 1015.08

+3
Answers (2)
  1. 8 August, 14:56
    0
    import java. util. Scanner;

    public class Main

    {

    public static void main (String[] args) {

    Scanner input = new Scanner (System. in);

    System. out. print ("Enter the initial balance: ");

    double initialBalance = input. nextDouble ();

    System. out. print ("Enter the annual interest rate: ");

    double annualInterestRate = input. nextDouble ();

    double monthlyInterest = (annualInterestRate / 100) / 12;

    double currentBalance = initialBalance + (initialBalance * monthlyInterest);

    for (int month=1; month<=3; month++) {

    System. out. printf ("Your balance after " + month + ". month: %.2f / n", ((initialBalance + (initialBalance * monthlyInterest) * month)));

    }

    }

    }

    Explanation:

    * The code is written in Java

    - Ask user to enter initial balance and annual interest rate

    - Calculate the monthly interest

    - Calculate the current balance

    - Print the value of the balance after first three months using for loop
  2. 8 August, 14:59
    0
    init_balance = float (input ("Initial balance: ")) interest = float (input ("Annual interest rate in percent: ")) montly_interest = (interest / 100) / 12 current_amount = init_balance + init_balance * montly_interest print ("After first month: %.2f " % current_amount) current_amount = current_amount + current_amount * montly_interest print ("After second month: %.2f " % current_amount) current_amount = current_amount + current_amount * montly_interest print ("After third month: %.2f " % current_amount)

    Explanation:

    The solution code is written in Python.

    Firstly, prompt user to input initial balance and annual interest rate using input function (Line 1 - 2).

    Next, divide the annual interest by 100 and then by 12 to get the monthly interest rate (Line 4).

    Apply the formula to calculate the current amount after adding the monthly interest (Line 5) and display the current month after first month (Line 6).

    Repeat the same steps of Line 5 - 6 to calculate amount after two and three months and display print them to console. (Line 8 - 12).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “An online bank wants you to create a program that shows prospective customers how their deposits will grow. Your program should read the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers