Project: Calculator
//Name: Ilana Levy
//Period: 5
//Program Name: Project Calculator
//File Name: calcProj.java
//Date Finnished: 6/1/2016
import java.util.Scanner;
public class calcProj{
public static void main( String[] args){
Scanner scan = new Scanner( System.in);
double first = 1;
while (first != 0){
System.out.print( ">");
first = scan.nextInt();
String function = scan.next();
double second = scan.nextInt();
if (first != 0){
if (function.equals("+")){
System.out.println(first + second);
}
else if (function.equals("-")){
System.out.println(first - second);
}
else if (function.equals("*")){
System.out.println(first * second);
}
else if (function.equals("/")){
System.out.println(first/second);
}
else if (function.equals("^")){
int product = 1;
for ( int i = 0; i < second; i++)
product *= first;
System.out.println(product);
}
else if (function.equals("%"))
System.out.println(first%second);
else
System.out.println( "ERROR");
}
}
}
}