Question: Java Create a class named Sandwich. Data fields include a String for the main ingredient (such as tuna) as mainingredient, a String for bread type

Java  Java Create a class named Sandwich. Data fields include a String
for the main ingredient (such as tuna) as mainingredient, a String for

Create a class named Sandwich. Data fields include a String for the main ingredient (such as tuna) as mainingredient, a String for bread type (such as wheat) as bread, and a double for price (such as 4.99) as price. Tasks Create the Sandwich class. Add the three data fields to the Sandwich class. Include methods to get and set values for each of the three data fields. Tasks Add set and get methods for the mainIngredient data field. Add set and get methods for the bread data field Add set and get methods for the price data field." Create an application named TestSandwich that prompts the user for data, instantiates one Sandwich object, and displays its values. An example of the program is shown below: Enter main sandwich ingredient tuna Enter bread, type wheat Enter sandwich price 8.50 You have ordered a tuna sandwich on whea

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!