All items in an assumed bookstore order management system implement interface Item. Here is the partial implementation of Item and a Book class:
interface Item {
double getPrice();
//... more methods
}
class Book implements Item {
//.. more methods and cotr
public double getPrice() {
return price;
}
double price;
// .. more fields
}
Order is a generic class that represents order of any item (any class that implements Item). We have hid part of the type parameter of Order ( see ____ below). Note that getCost method of Order calls getPrice() on field item. You have to give complete declaration of type parameter of Order.
class Order< I ____ > {
Order(I i, int q) {
item = i;
quantity = q;
}
double getCost() {
return item.getPrice() * quantity;
}
I item;
int quantity;
}
Which one of followings is the appropriate type parameter of Order that allows it be defined for any class that implements Item?