Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GroceryItem implements Carryable {
- String name;
- float price;
- float weight; // in kg
- public GroceryItem (String n, float p, float w){
- name = n;
- price = p;
- weight = w;
- }
- public GroceryItem[] getContents(){
- return new GroceryItem[0];
- }
- public String getDescription(){
- return name;
- }
- public float getPrice(){
- return price;
- }
- public String toString(){
- return name + "weighing" + weight + "kg with price" + price;
- }
- }
Add Comment
Please, Sign In to add comment