Computer Science, asked by abhinavraj0001, 1 year ago

write a switch case program to find SI and CI in bluej or java

Answers

Answered by tanuja75
0
Here we share the code in five different formats to find compound interest program. Using standard values, using recursion, using command line arguments, using while loop, for loop , and using function method etc.


Hope it's help u:-)

abhinavraj0001: not the answer to my question
Answered by muakanshakya
10
import java.util.*;
class Choice
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int ch;
System.out.println("enter your choice=");
ch=sc.nextInt();
System.out.println("enter the principal")
double p = sc.nextDouble();
System.out.println("enter the rate");
double r=sc.nextDouble();
System.out.println("enter the time");
double t=sc.nextDouble();
switch(ch)
{
case 1:
double si;
si=p*r*t/100;
System.out.println("the si of this given data is"+si);
break;
case 2:
double amt,ci;
amt=p*(1+r/100)^t;
ci=amt-p;
System.out.println("ci of the given data's is="+ci);
break/;
default:System.out.println("wrong choice");
}
}
}
Similar questions