Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (50 points) a. Create a class named Sandwich. Data fields include a String for the main ingredient (such as tuna, chicken, beef, turkey

Question 1 (50 points)

a. Create a class named Sandwich. Data fields include a String for the main ingredient (such as tuna, chicken, beef, turkey), a String for bread type (such as wheat, multigrain, cracked wheat), and a double for price (such as 4.99). Include methods to get and set values for each of these fields. Save the class as Sandwich.java.

b. Create an application named TestSandwich that instantiates two Sandwich objects, a regular sandwich and a vegan sandwich with Tofu as the main ingredient. The regular sandwich is priced at 6.99 and the vegan sandwich is priced at 7.25. Demonstrates the use of the set and get methods and display the properties of both sandwiches in the console. Save this application as T estSandwich.java.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

General And Industrial Management

Authors: Henri Fayol, Constance Storrs

1st Edition

1614274592, 978-1614274599

More Books

Students also viewed these General Management questions

Question

Data integrity is a big deal in industry? Why?

Answered: 1 week ago

Question

What are the social and physical elements of the service encounter?

Answered: 1 week ago

Question

1 What is meant by systematic training?

Answered: 1 week ago