1
1337Snak3
Guest
okay, if you dont know what this is, it's calculator.
If u've done anything in java u can use this.
I hope u get along with my english in the program...
If u've done anything in java u can use this.
I hope u get along with my english in the program...
Code:
import java.util.Scanner;
// sythe.org 1337Snak3
public class Javculator {
public static void main(String[] args) throws Exception {
Scanner skanneri = new Scanner(System.in);
System.out.println("please,type the first number(s) example 53 or 8 or anything like that,press enter");
int a = skanneri.nextInt();
System.out.println("Now, the second number(s),press Enter");
int b = skanneri.nextInt();
System.out.println("Now,type what you wanna do about the numbers you earlier gave, 1 for plus 2 for minus 3 for times or what do they ever call it and 4 for the example 28/7 = 4 things ");
int c = skanneri.nextInt();
double x = a;
double y = b;
int res1 = a+b;
int res2 = a-b;
int res3 = a*b;
double res4 = x/y;
while (c != 0) {
switch (c) {
case 1:
System.out.println(a + " plus "+ b +" is :"+ res1);
break;
case 2:
System.out.println(a + " minus "+ b +" is :"+ res2);
break;
case 3:
System.out.println(a + " times "+ b +" is :"+ res3);
break;
case 4:
System.out.println(a + " shared "+ b +" is :"+ res4);
break;
default:
System.out.println(" Are you sure you gave a number 1-4 when asking what you want to do?");
}
System.out.println("now, you can change the way to calculate if you wish to.");
c = skanneri.nextInt();
}
}
}
