12. An employee wants to deposit certain sum of money under "Term Deposit
scheme in Syndicate Bank. The bank has provided the tariff of the scheme,
which is given below:
No. of Days
Up to 180 days
181 to 364 days
Rate of Interest
5.5%
7.5%
No. of Days
Exact 365 days
More than 365 days
Rate of Interest
9.0%
8.5%
Write a program to calculate the maturity amount taking the sum and number
of days as inputs.
Answers
Answer:
According to the problem here we need to calculate the maturity amount
we have taken input from user by using scanner instance.
import java.util.Scanner;
class Term_Deposit
{
public static void main(String args[])
{
Scanner s1=new Scanner(System.in);
int b;
Double depositing_amount, period_deposit ,amount;
System.out.println("depositing amount");
System.out.println("period of deposit");
depositing_amount = period_deposit = sc.nextDouble();
b=s1.nextInt();
if(b<=180)
{
depositing_amount=(depositing_amount*5.5)/100;
System.out.println("interest"+depositing_amount);
}
else if(b>180&&b<=364)
{
depositing_amount=(depositing_amount*7.5)/100;
System.out.println("interest"+depositing_amount);
}
else if(b==365)
{
depositing_amount=(depositing_amount*9.0)/100;
System.out.println("interest"+depositing_amount);
}
else if(b>365)
{
depositing_amount=(depositing_amount*8.5)/100;
System.out.println("interest"+depositing_amount);
}
amount=period_deposit +depositing_amount;
System.out.println("amount"+amount);
}
}
Answer: