Compound Interest

Procedure

Real Lab Procedure 

  1. Variable "n" holds the principal amount.
  2. Variable "r" is used to indicate rate of interest per annum. 
  3. Variable "y" is used to indicate the number of years. 
  4. Standard equation for calculating the compound interest rate is "n = n+((n*r)/100)."
  5. Step 4 should execute "y" times.

  • n=float(input())             # Prompt the user to enter the initial principal amount (initial investment or loan amount) 
  • r= float (input())            # Prompt the user to enter the rate of interest 
  • y= float (input())            # Prompt the user to enter the time period in years 
  • for i in range(y):            # Loop through each year to calculate compound interest 
  •       n=n+((n*r)/100)  # Calculate compound interest for the current year and update the principal amount 
  • print(n)                         # Print the total amount after compound interest for the specified number of years 

Simulator Procedure

  • Enter the input values. 
  • Click on the Submit button. 
  • Select the variables from the dropdown list.
  • Click on the Finish button or Start button to view the state diagram.
  • If you have clicked on the Start button, then use the Next and Previous buttons to view the state diagram.
  • Click on the Reset button when the State diagram is completed.

 

Requirements

The program provided is a simple Python script that should run on a variety of systems with minimal hardware and software requirements. 

Hardware Requirements

Computer: Any modern computer capable of running Python. 

Input Devices: Keyboard (for entering input). 

Software Requirements

 Python: Python 3.0.x or newer. 

Code Editor or IDE: PyCharm 2023.3 or above / Atom 1.57.0 or above / IDLE 3.13or newer. 

Change the program such a way that program accepting floating values. I.e use float() instead of int().