3. Develop a program, that accepts a deposit amount and calculates the amount of interest earned on the deposited amount in a year. Where, the bank pays:
- flat 4% for deposits of up to Rs.1000
- flat 4.5% per year for deposits of up to Rs.5000
- flat 5% for deposits of more than Rs.5000
Logic of the solution:
- Declare amount and intst as a double type as the user can have an amount of decimal points too.
- Print a message for the user using System.out.println and ask the user for a amount
- Store the amount entered by the user into the variable amount
- Using if statement check if the amount is less than 1000 then
- Interest will be 4%
- Otherwise, if it is between 1001 & 5000 then
- Interest will be 4.5%
- Interest will be 5% flat
- While storing the interest calculated in the intst variable that will be printed finally.
public static void main(String  arg)
Scanner sc = new Scanner(System.in);
System.out.println("Enter the amount");
else if(amount>=1001 && amount<=5000)
System.out.println("Interest Amount is = "+intst);
Alternative logics that can be applied:
This question can also be solved using the switch conditional statement.
Continue to next page for another question.