Please solve Q. 19 and use Scanner class.
Answers
b) ci= p* ((1+R/100)t-1)
Answer:
import java.util.*;
class Interest
{
public static void main(String args[ ])
{
Scanner in=new Scanner (System.in)
System.out.println("Enter the principal amount, rate of interest and time period");
double p=in.nextDouble();
double r=in.nextDouble();
double t=in.nextDouble();
double I=0.0;
System.out.println("Enter the type of interest. S for simple and C for compound interest.");
char i=in.nextChar();
if(i== 'S')
{
I=(p*r*t)/100;
}
else if(i=='C')
{
I=p[(1+r/100)^t)-1];
}
else
{
System.out.println("Wrong input");
}
double amt= p+I;
System.out.println("Interest on "+p+"="+I);
System.out.println("Total sum after interest="+amt);
}
}
Please mark as Brainliest if understood. If any doubt then please ask.