我把我写的东西都压缩到文档里了,哪位帮忙看一下
这里是代码要求的链接:
http://www.cise.ufl.edu/class/cop3503sp12/projects/proj2/
我运行测试程序时, sorting videogames by releasing date总是不能让发行日期递减排列,而且和我的输出和老师给的标准输出
不一样。 实在不知道怎么写了,哪位资深人员帮我修改一下,
谢谢了, 急需
我把我写的东西都压缩到文档里了,哪位帮忙看一下
这里是代码要求的链接:
http://www.cise.ufl.edu/class/cop3503sp12/projects/proj2/
我运行测试程序时, sorting videogames by releasing date总是不能让发行日期递减排列,而且和我的输出和老师给的标准输出
不一样。 实在不知道怎么写了,哪位资深人员帮我修改一下,
谢谢了, 急需
你的Date类的比较方法逻辑很混乱,帮你改了一下:
[code]
public int compareTo(Date date) {
/** YOUR CODE GOES HERE ***/
/**
if(this.month < date.getMonth() &&
this.year == date.getYear() &&
this.day == date.getDay())
{
return -1;
}
else if(this.month == date.getMonth() &&
this.year < date.getYear() &&
this.day == date.getDay())
{
return -1;
}
else if(this.month == date.getMonth() &&
this.year == date.getYear() &&
this.day < date.getDay())
{
return -1;
}
else if(this.month == date.getMonth() &&
this.year == date.getYear() &&
this.day == date.getDay())
{
return 0;
}
else return 1;
*/
if(this.year<date.getYear())
return -1;
else if(this.year>date.getYear())
return 1;
if(this.month<date.getMonth())
return -1;
else if(this.month>date.getMonth() )
return 1;
if(this.day<date.getDay())
return -1;
else if(this.day>date.getDay())
return 1;
return 0;
}
[/code]