Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write Java programs that uses concepts through chapter 11 and meets the following requirements: a. Create a class for a Sandwich Shop (you can name)
Write Java programs that uses concepts through chapter 11 and meets the following requirements: a. Create a class for a Sandwich Shop (you can name) with data fields for bread type (such as "rye") and calories per slice. Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Also include a public final static String named SLOGAN and initialize it to The Way A Sandwich Should Be. Write an application named TestBread to instantiate three Bread objects with different values, and then display all the data, including the Slogan, for each object. Save both the Bread.java and TestBread.java files b. Create a class named Sandwich Filling. Include a field for the filling type (such as "egg salad") and another for the calories in a serving. Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Write an application named TestSandwichFilling to instantiate three SandwichFilling objects with different values, and then display all the data for each object. Save both the SandwichFilling.java and TestSandwichFilling.java files c. Create a class named Sandwich. Include a Bread field and a Sandwich Filling field. Include a constructor that takes parameters for each field needed in the two objects and assigns them to each object's constructor. Write an application named TestSandwich to instantiate three Sandwich objects with different values, and then display all the data for each object, including the total calories in a Sandwich, assuming each Sandwich is made using two slices of Bread. Save both the Sandwich.java and TestSandwich. d. Create a class named Order that contains customer name, bread type and filling. The Sandwich shop carries 4 types of bread and 4 types of filling (you decide types of bread or filling the shop carries). Create a class named TestOrder that allows the customer to order as many sandwiches as wanted and prints out the customer name and then all the sandwiches (bread type, filling and total calories) ordered. At the beginning of all programs add comments as described in previous assignments
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started