interface Test{
public void division(double x, double y);
public void calMod(double x);
}
public class DivMod{
public void division(double x,double y){
double result;
result=(x/y);
System.out.println("Result for Division is="+result);
}
public void calMod(double x){
if(x<0){
System.out.println("Modulus of |"+x+"| is");
x=-x;
System.out.println(x);
}
else{
System.out.println("Modulus of |"+x+"| is"+x);
}
}
public static void main(String[] args){
DivMod dm= new DivMod();
dm.calMod(-12);
dm.division(14,7);
}
}
public void division(double x, double y);
public void calMod(double x);
}
public class DivMod{
public void division(double x,double y){
double result;
result=(x/y);
System.out.println("Result for Division is="+result);
}
public void calMod(double x){
if(x<0){
System.out.println("Modulus of |"+x+"| is");
x=-x;
System.out.println(x);
}
else{
System.out.println("Modulus of |"+x+"| is"+x);
}
}
public static void main(String[] args){
DivMod dm= new DivMod();
dm.calMod(-12);
dm.division(14,7);
}
}
No comments:
Post a Comment