وهذه الة حاسبة بسيطة (جمع - طرح - ضرب - قسمة )
كود PHP:
package javaapplication93;
import java.util.Scanner;
public class JavaApplication93 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("1-Addition");
System.out.println("2-subtraction");
System.out.println("3-multiplication");
System.out.println("4-Division");
System.out.println(" Enter you chose : ");
int chose=input.nextInt();
while(chose < 1 || chose > 4){
System.out.println(" wrong answer ........... enter again: ");
chose=input.nextInt();
}
switch(chose){
case 1: System.out.print(" Entre first number : ");
int z=input.nextInt();
System.out.print(" Entre second number : ");
int x=input.nextInt();
int sum= z + x;
System.out.println(" The sum of number " + z + " + " + " number " + x + " equal " + sum);
break;
case 2: System.out.print(" Entre first number : ");
int v=input.nextInt();
System.out.print(" Entre second number : ");
int b=input.nextInt();
int subtraction= v - b;
System.out.println(" The subtraction of number " + v + " - " + " number " + b + " equal " + subtraction);
break;
case 3: System.out.print(" Entre first number : ");
int l=input.nextInt();
System.out.print(" Entre second number : ");
int e=input.nextInt();
int multiplication= l * e;
System.out.println(" The multiplication of number " + l + " * " + " number " + e + " equal " + multiplication);
break;
case 4: System.out.print(" Entre first number : ");
int k=input.nextInt();
System.out.print(" Entre second number : ");
int w=input.nextInt();
int Division= k / w;
System.out.println(" The Division of number " + k + " / " + " number " + w + " equal " + Division);
break;
}
}
}