write a switch case program to find SI and CI in bluej or java
Answers
Answered by
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:-)
Hope it's help u:-)
abhinavraj0001:
not the answer to my question
Answered by
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");
}
}
}
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
English,
9 months ago
India Languages,
9 months ago
Math,
9 months ago
Computer Science,
1 year ago
Chemistry,
1 year ago
Math,
1 year ago
Physics,
1 year ago