This is a simple Java-based console application that calculates both Simple Interest and Compound Interest. It takes user input for the principal amount, interest rate, and time period, then computes and displays the results. The program includes error handling for invalid inputs.
- Calculates Simple Interest using the formula:
SI = (P * R * T) / 100
- Calculates Compound Interest using the formula:
CI = P * (1 + R/100)^T - P
- Handles invalid inputs (negative values, non-numeric inputs)
- User-friendly CLI-based interaction
- Java Development Kit (JDK) 8 or higher
- A Java-compatible IDE (e.g., IntelliJ IDEA, Eclipse) or a terminal with
javac
andjava
- Clone this repository:
git clone https://github.com/nurulashraf/java-simple-interest-calculator.git
- Navigate to the project folder:
cd java-simple-interest-calculator
- Compile the Java program:
javac -d bin src/simpleinterestcalculator/SimpleInterestCalculator.java
- Run the program:
java -cp bin simpleinterestcalculator.SimpleInterestCalculator
- Enter the principal amount.
- Enter the annual interest rate in percentage.
- Enter the time period in years.
- The program will display both Simple Interest and Compound Interest.
Enter Principal Amount: 1000
Enter Annual Interest Rate (in %): 5
Enter Time Period (in years): 3
Simple Interest: 150.00
Compound Interest: 157.63
java-simple-interest-calculator/
│── src/
│ └── SimpleInterestCalculator.java
│── README.md
└── LICENSE
This project is licensed under the MIT License. See the LICENSE
file for details.