Help with mathematical methods
I have to write a a program that gives me sum(), difference(), product(), division(), remainder().
this is what i have so far.
Code:
import javax.swing.JOptionPane;
public class Ok
{
public static void main (String args[])
{
int result=0;
int input1 =0;
int input2 =0;
input1=Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the first number:"));
input2=Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the second number:"));
result=sum(input1, input2);
JOptionPane.showMessageDialog (null, "The result is: " + result);
}
public static int sum (int x, int y)
{
return (x+y);
}
}
Thanks.
Marcus:cool: