Source Code
package MRCWORKLIB;
public class Validate
{
public void valid_fields(String[] args)
{
String strdatex = args[1].replaceAll(",", "");
String enddatex = args[2].replaceAll(",", "");
int strdate = Integer.parseInt(strdatex);
int enddate= Integer.parseInt(enddatex);
if ((strdatex.compareTo("0") == 0 ) && (enddatex.compareTo("0") == 0 ))
{
args[0] = "You have not entered any dates";
return;
}
else if (strdatex.compareTo("0") == 0)
{
args[0] ="You must enter a starting date";
return;
}
else if (enddatex.compareTo("0") == 0)
{
args[0] = "You must enter an end date";
return;
}
else if(strdate > enddate)
{
args[0] = "Starting Date is greater than End Date";
return;
}
else return;
}
}