U E D R , A S I H C RSS

데블스캠프2009/수요일/JUnit/강소현

No difference found



데블스캠프2009/수요일/JUnit/강소현


public class Calculator {

	private int operand1;
	private int operand2;
	private char operator1;
	private double result;
	
	public double calculate(char op, int num1, int num2)
	{
		operand1=num1;
		operand2=num2;
		operator1=op;
		
		switch(op)
		{
		case '+':
			addition();
			break;
		case '-':
			subtraction();
			break;
		case '*':
			multiplication();
			break;
		case '/':
			division();
			break;
			
		}
		
		return result;
	}
	
	public void addition()
	{
		result=operand1+operand2;
	}
	public void subtraction()
	{
		result=operand1-operand2;
	}
	public void multiplication()
	{
		result=operand1*operand2;
	}
	public void division()
	{
		result=operand1/operand2;
	}

}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:09
Processing time 0.0382 sec