Challenge

Project

import java.util.Scanner;
public class ScientificCalculator {
public static void main(String[] args){
System.out.println("List of the operation:- "+"\n"+"1. +-plus or addition ln"+"\n"+
"2. - -minus or subtraction "+"\n"+
"3. * -multiply by "+"\n"+
"3. / -divided by "+"\n"+
"4. ^ -raised to the power of- x raised to the y "+"\n"+
"5. Sqrt - square root "+"\n"+
"6. Nrt - nth root "+"\n"+
"7. log - Logarithmic value "+"\n"+
"8. logn- Natural log "+"\n"+
"9. sin- Sine "+"\n"+
"10. isin -Inverse sine "+"\n"+
"11. cos - Cosine "+"\n"+
"12. icos - Inverse cosine "+"\n"+
"13. tan - Tangent "+"\n"+
"14. itan - Inverse tan "+"\n"+
"15. stor -place a number in memory for later use "+"\n"+
"16. recall -recover the number from memory for immediate use "+"\n"+
"17. d2b -Decimal to Binary number "+"\n"+
"18. b2d -Binary to Decimal number "+"\n"+
"19. sip- Calculations of monthly, quarterly and yearly SIP calculations for compounding investments "+"\n"+
"20. exit- To Stop the operation.");
int X = 0;
while (true)
{
System.out.println("Choose the number from above list of which you want the operation and enter it.");
Scanner sc=new Scanner(System.in);
int A=sc.nextInt();
if (A==1) {
System.out.println("Enter the first number");
int g=sc.nextInt();
System.out.println("Enter the Second number");
int f=sc.nextInt();
System.out.print("The sum of the number's is ");
System.out.print(g+f);
System.out.println("\n");
}
else if (A==2) {
System.out.println("Enter the first number");
int g=sc.nextInt();
System.out.println("Enter the Second number");
int f=sc.nextInt();
System.out.print("The subtraction of the number's is ");
System.out.print(g-f);
System.out.println("\n");
}
else if (A==3) {
System.out.println("Enter the first number");
int g=sc.nextInt();
System.out.println("Enter the Second number");
int f=sc.nextInt();
System.out.print("The multiplication of the number's is ");
System.out.print(g*f);
System.out.println("\n");
}
else if (A==4) {
System.out.println("Enter the Numerator");
float g=sc.nextFloat();
System.out.println("Enter the Denominator");
float f=sc.nextFloat();
System.out.print("The division of the number's is ");
System.out.print(g/f);
System.out.println("\n");
}
else if (A==5) {
System.out.println("Enter the number of which we have to find the power");
double g=sc.nextFloat();
System.out.println("Enter the number which is at power");
double f=sc.nextFloat();
System.out.print("The value is ");
System.out.print(Math.pow(g, f));
System.out.println("\n");
}
else if (A==6) {
System.out.println("Enter the number of which you want the square root");
float g=sc.nextFloat();
System.out.print(Math.sqrt(g));
System.out.println("\n");
}
else if (A==7) {
System.out.println("Enter the number of which you want the logarithmic value.");
float g=sc.nextFloat();
System.out.print(Math.log(g));
System.out.println("\n");
}
else if (A==8) {
System.out.println("Enter the number of which you want the natural logarithmic value.");
float g=sc.nextFloat();
System.out.println(Math.log10(g));
System.out.println("\n");
}
else if (A==9) {
System.out.println("Enter the value of angle");
float g=sc.nextFloat();
System.out.println(Math.sin(g));
System.out.println("\n");
}
else if (A==10) {
System.out.println("Enter the value ");
float g=sc.nextFloat();
System.out.println(Math.asin(g));
System.out.println("\n");
}
else if (A==11) {
System.out.println("Enter the value of angle");
float g=sc.nextFloat();
System.out.println(Math.cos(g));
System.out.println("\n");
}
else if (A==12) {
System.out.println("Enter the value");
float g=sc.nextFloat();
System.out.println(Math.acos(g));
System.out.println("\n");
}
else if (A==13) {
System.out.println("Enter the value of angle");
float g=sc.nextFloat();
System.out.println(Math.tan(g));
System.out.println("\n");
}
else if (A==14) {
System.out.println("Enter the value");
float g=sc.nextFloat();
System.out.println(Math.atan(g));
System.out.println("\n");
}
else if (A==15) {
System.out.println("Enter the value to be stored");
X=sc.nextInt();
System.out.println("\n");
}
else if (A==16) {
System.out.println("Stored value is");
System.out.println(X);
System.out.println("\n");
}
else if (A==17) {
System.out.println("Enter the number which is present in decimal form");
int g=sc.nextInt();
System.out.println(Integer.toBinaryString((int) g));
System.out.println("\n");
}
else if (A==18) {
System.out.println("Enter the number which is present in binnary form");
String g=sc.next();
System.out.println("Enter the value of radix");
int r=sc.nextInt();
System.out.println(Integer.parseInt(g, r));
System.out.println("\n");
}
else if (A==19) {
double fv;
double n;
double i;
double p;
double rate;
System.out.println("Enter the amount you invest");
p=sc.nextDouble();
System.out.println("Enter the percentage of expected annual rate of return");
rate=sc.nextDouble();
System.out.println("Enter the investment duration.");
n=sc.nextDouble();
i=rate/100/12;
fv= (p*(Math.pow(1+i, n)-1)*(1+i)/i);
System.out.println(fv);
System.out.println("\n");
}
else if(A==20){
break;
}
}
}
}

1 comment
  1. Dasari Divyahow to find the code
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.