13 program using scanner class
Attachments:
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Loan
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int time;
double principal,rate,interest;
System.out.println("Enter amount sanctioned");
principal=sc.nextDouble();
System.out.println("Enter years for which loan is sanctioned");
time=sc.nextInt();
if(time<=5)
{
rate=15.0;
}
else if(time<=10&&time>5)
{
rate=12.0;
}
else
{
rate=10.0;
}
interest=principal*time*rate/100;
System.out.println("Interest is "+interest+" at rate of "+rate+"%");
}
}
Explanation:
Hope it helps :-)
Similar questions