Question: I need help with my java class. I have a sandwich class where I can make a sandwich with a name and price. public Sandwich(double

I need help with my java class. I have a sandwich class where I can make a sandwich with a name and price.

public Sandwich(double price) {//constructor to set variables

super();

this.name="Sandwich";

this.price = price;

}

/* getters and setters */

public void setName(String name) {

this.name = name;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

}

How can I make it so for example, someone ordered a ham and cheese sandwich but wanted to add tomatoe or another topping. Thank you for the help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!