Question: Create a class named Sandwich that contains the following data fields: MainIngredient - of type String Bread - of type String Price - of type

  • Create a class named Sandwich that contains the following data fields: MainIngredient - of type String Bread - of type String Price - of type Double Include get and set methods for these fields. The methods should be prefixed with 'get' or 'set' respectively, followed by the field name using camel case. For example, setMainIngredient. Use the application named TestSandwich that instantiates one Sandwich object and demonstrates the use of the set and get methods to test your class.




Step by Step Solution

3.34 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class Sandwich String MainIngredient String Bread double Pr... View full answer

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 Accounting Questions!