谁有java程序啊?程序代码要50条以上的,也不要太多!谢谢!

来源:百度知道 编辑:UC知道 时间:2024/06/01 15:36:40
我要有程序代码和结果的!结果一定要有的哦!而且可以运行啊!

public class IntegerTest
{
int x;
int y;

public IntegerTest(int x,int y)
{
this.x=x;
this.y=y;
}

public int sum()
{
return this.x+this.y;
}

public int minus()
{
return this.x-this.y;
}

public int multiply()
{
return this.x*this.y;
}

public int chu()
{
return this.x/this.y;
}

public int mod()
{
return this.x%this.y;
}

public int max()
{
if(this.x>=this.y)
{
return this.x;
}
return this.y;
}

public int min()
{
if(this.x<=this.y)
{
return this.x;
}
return this.y;
}

public static void main(String args[])
{
IntegerTest i=new IntegerTest(2,3);
System.out.println("x+y="+i.sum()+"\nx-y="+i.minus()+"