public class Rice extends Item {
double weight;
double price;
public Rice(String name, double weight, double price) {
super(name);
this.weight = weight;
this.price = price;
}
@Override
public int getCost() {
return (int) Math.ceil(weight * price);
}
@Override
public String toString() {
return “rice” + weight + “lbs @” + GroceryStore.cents2dollarsAndCents(getCost());
}
}