Hello bluekswing.
Why don't you just create a class that can compare two Double numbers. For example:
public class NumberCompare{
public enum TOperation {equals, greater, smaller, greaterOrEqual, smallerOrEqual};
private TOperation operation = TOperation.equals;
public void setOperation(TOperation operation){
this.operation = operation;
}
public TOperation getOperation(){
return this.operation;
}
public boolean compare(Double first, Double second){
switch (operation){
case equals :
return first == second;
break;
case greater:
return first > second;
break;
case smaller:
return first < second;
break;
case greaterOrEqual:
return first >= second;
break;
case smallerOrEqual:
return first <= second;
break;
default:
return false;
}
}
}
Now you can create a single NumberCompare object and change its operator as you need. Then you can call its compare() method. You can create a similar class for preforming the calculations. You can do the same for String objects.
This code has been checked by hand. I hope this helped.
