osmm
2008-03-09 13:36:34
Its not that great, you can only do the basics, + - / and *. Also if the answer is a decimal it will automaticly show 0. Other wise it is prety good. Right now it only handles 2 numbers. I coulda make it use more but then stuff would be all messed up. Anyways to anyone who actually looks at this section here it is:
public class Calculator
{
public static void main(String[]args)
{
String symbol1 = "division";
/* what type of math to do;
* Addition
* Subtraction
* Multiplaction
* Division
*/
int num1 = 2; // number one here
int num2 = 2; // number two here
//-------------------------------------------------------\\
//-------------------------------------------------------\\
//-------------------------------------------------------\\
if (symbol1 == "multiplaction")
{
System.out.println(num1 + " * " + num2 + " = " + (num1 * num2));
}
if (symbol1 == "division")
{
System.out.println(num1 + " / " + num2 + " = " + (num1 / num2));
}
if (symbol1 == "subtraction")
{
System.out.println(num1 + " - " + num2 + " = " + (num1 - num2));
}
if (symbol1 == "addition")
{
System.out.println(num1 + " + " + num2 + " = " + (num1 + num2));
}
}
}