The book in question invokes the method. The only additional information needed is the desired amount. We expect it to be an integer.
// determine whether this book is cheaper than the given amount
boolean cheaperThan(int amount){...}
b1.cheaperThan(100) -- expected: true b2.cheaperThan(10) -- expected: false
boolean cheaperThan(int amount){...}
... this.title ...
... this.author ...
... this.price ...
... this.year ...
}
boolean cheaperThan(int amount){
return this.price < amount;
}
b1.cheaperThan(100) == true b2.cheaperThan(10) == false