answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
olga2289
2 months ago
8

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
Computers and Technology
2 answers:
ivann1987 [1K]2 months ago
8 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

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

 double initialBalance = input.nextDouble();

 System.out.print("Please 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("Balance after month " + month + ": %.2f \n", ((initialBalance + (initialBalance * monthlyInterest)* month)));

 }

}

}

Explanation:

* The provided code is developed in Java

- Requests the user to provide the initial balance and the annual interest rate

- Computes the monthly interest rate

- Determines the current balance

- Calculates the balance amount after the first three months, utilizing a loop for repetition

8_murik_8 [964]2 months ago
5 0

Answer:

  1. init_balance = float(input("Enter initial balance: "))
  2. interest = float(input("Enter the annual interest rate in percent: "))
  3. monthly_interest = (interest / 100) / 12
  4. current_amount = init_balance + init_balance * monthly_interest
  5. print("Balance after first month: %.2f " % current_amount)
  6. current_amount = current_amount + current_amount * monthly_interest
  7. print("Balance after second month: %.2f " % current_amount)
  8. current_amount = current_amount + current_amount * monthly_interest
  9. print("Balance after third month: %.2f " % current_amount)

Explanation:

The following code is written in Python.

First, prompt the user to input the initial balance and annual interest rate (Lines 1-2).

Next, derive the monthly interest rate by dividing the annual interest by 100 and then by 12 (Line 4).

The calculations for the current amount are applied, adding the monthly interest (Line 5) and displaying the balance after the first month (Line 6).

This procedure is repeated to compute amounts for the second and third months, followed by printing the results to the console (Lines 8-12).

You might be interested in
Life changing technology is easy to fall in love with. Describe a feature of a product that did it for you and highlight its ben
Amiraneli [1052]

An example of transformative technology that significantly affected my life is Artificial Intelligence.

Whether through Google Assistant, Amazon Alexa, or an AI-powered online medical consultant, this technology offers dependable and valuable assistance.

It helps manage daily reminders amidst a busy schedule or provides medical advice for a sick family member without needing a hospital visit, and often offers useful suggestions.

This technology has altered our lives in various ways, including my own.

5 0
4 months ago
The parent_directory function returns the name of the directory that's located just above the current working directory. Remembe
Amiraneli [1052]

Answer:

Below is the complete code for this question:

import os #importing package

def parent_directory():#defining method parent_directory

   dir = os.getcwd()#storing current working directory in dir

   relative_parent = os.path.join(dir) #from dir, define relative_parent variable using join method

   return os.path.dirname(relative_parent)#return the directory name using return keyword

print(parent_directory())#use print to invoke parent_directory method

Output:

/

Note:

This program executes in an online compiler, hence it returns "/"

Explanation:

The provided Python code imports the "os" package, after which it defines a method called "parent_directory" that uses the variable dir to store the current working directory through the "getcwd" method.

  • Next, the variable "relative_parent" is defined, using the join method to store the directory value and returning its value.
  • Lastly, the print function is called to output the method's result.
6 0
3 months ago
Other questions:
  • In what areas is Leslie's underspending hurting her budget select all that apply
    5·1 answer
  • This question involves a simulation of a two-player game. In the game, two simulated players each start out with an equal number
    7·1 answer
  • explain why entrepreneurial activities are important to social development and progress of the econo​
    9·1 answer
  • Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
    7·1 answer
  • An extranet is like an intranet except that it allows company employees access to corporate Web sites from the ______
    13·1 answer
  • Write a MATLAB function named lin_spaced_vector with two inputs and one return value. The first input will be a single real numb
    7·1 answer
  • You've just purchased 10 new notebook systems for your users. You are concerned that users will leave the systems on for long pe
    10·1 answer
  • Mark, a programmer, is testing his program in order to locate syntax errors. Which skill will help Mark most in detecting and re
    10·1 answer
  • A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, A3 contains 7. You enter in cell A4 the followi
    8·1 answer
  • Assume we have a computer where the clocks per instruction (CPI) is 1.0 when all memory accesses hit in the cache. The only data
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!