11A
Write an interface Qualifiable
. It has one method qualify()
which determines if the object qualifies according to some set of criteria. It returns true if the object qualifies and returns false otherwise.
Modify the BankAccount
class included in Codecheck (at the final URL) so that it implements Qualifiable
. A bank account qualifies if the balance is over $10,000. Something like this could be used to determine if the account qualified for free checking.
Modify Student
class included in Codecheck (at the final URL) to implement Qualifiable
. A Student qualifies if his/her GPA is greater than or equal to 3.54. This might be used to see if students qualified for the Dean's Honor Roll or to change their major to Computer Science.
For the draft, just write the Qualifiable
interface. There a a hidden class Dummy in Codecheck. It let's me test your interface. Do not worry about it. You can not compile and execute the Runner class in Bluej. The draft is one problem you will have to test in Codecheck. You will not write a Dummy class.
To add an interface to a Bluej project, click New Class... and select interface. Interface names should start with uppercase just like class names.
In the final, you will need to upload the interface as well as the BankAccount
and Student
classes in Codecheck
11B
Modify the given Square
class to implement the Comparable
interface from the Java library. (Do not write your own interface). One Square
comes before another if its side is smaller (compareTo
will return a negative number). One Square
comes after another if its side is larger (compareTo
will return a positive number). If the two Square
have the same side compareTo
returns 0.
For the draft, add the implements Comparable
clause to the Square
class and then implement compareTo
as a stub that always returns 0.
Note: You will get a compiler warning about "unsafe or unchecked operations" when you compile SquareTester for the draft. You can safely ignore it for now.
11C
Modify the class Country
to implement the Comparable interface from the Java library. (Do not write your own interface). Country
objects are ordered by area. One Country
is smaller than another if its area is smaller. If two Country
objects have the same area, the one with the name that comes first in alphabetical order is smaller.
For the draft, add the implements Comparable
clause to the Country
class and then implement compareTo
as a stub that always returns 0.
Note: You will get a compiler warning about "unsafe or unchecked operations" when you compile CountryTester for the draft. You can safely ignore it for now.