fix BookStore
This commit is contained in:
1 file changed
+9
-7
@@ -256,13 +256,13 @@ public class BookStore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (longest != null)
|
if (longest == null)
|
||||||
{
|
{
|
||||||
System.out.println(longest.getTitle());
|
System.out.println("No longest title found");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("No longest title found");
|
System.out.println(longest.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,12 +353,14 @@ public class BookStore
|
|||||||
{
|
{
|
||||||
oldest = novel;
|
oldest = novel;
|
||||||
}
|
}
|
||||||
|
else if (novel.getYearPublished() < oldest.getYearPublished())
|
||||||
|
{
|
||||||
|
oldest = novel;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (novel.getYearPublished() < oldest.getYearPublished())
|
// nothing to do
|
||||||
{
|
throw new IllegalArgumentException("CRASH");
|
||||||
oldest = novel;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user