Question: * * * * please do this in C# * * * * * * The menu at a lunch counter includes a variety of
please do this in C#
The menu at a lunch counter includes a variety of sandwiches, salads, and drinks. The menu also allows a
customer to create a "trio," which consists of three menu items: a sandwich, a salad, and a drink. The price
of the trio is the sum of the two highestpriced menu items in the trio; one item with the lowest price is free.
Each menu item has a name and a price. The four types of menu items are represented by the four classes
Sandwich, Salad, Drink, and Trio. All four classes implement the following MenuItem interface.
The following diagram shows the relationship between the MenuItem interface and the Sandwich,
Salad, Drink, and Trio classes.
For example, assume that the menu includes the following items. The objects listed under each heading are
instances of the class indicated by the heading.
Sandwich
"Cheeseburger"
Salad
"Spinach Salad"
Drink
"Orange Soda"
"Club Sandwich"
"Cappuccino" The menu allows customers to create Trio menu items, each of which includes a sandwich, a salad, and a drink. The name of the Trio consists of the names of the sandwich, salad, and drink, in that order, each separated by and followed by a space and then "Trio". The price of the Trio is the sum of the two highestpriced items in the Trio; one item with the lowest price is free. A trio consisting of a cheeseburger, spinach salad, and an orange soda would have the name "CheeseburgerSpinach SaladOrange Soda Trio" and a price of $the two highest prices are $ and $ Similarly, a trio consisting of a club sandwich, coleslaw, and a cappuccino would have the name "Club SandwichColeslawCappuccino Trio" and a price of $the two highest prices are $ and $
Write the Trio class that implements the MenuItem interface. Your implementation must include a constructor that takes three parameters representing a sandwich, salad, and drink. The following code segment should have the indicated behavior. Sandwich sandwich; Salad salad; Drink drink; Code that initializes sandwich, salad, and drink Trio trio new Trio sandwich salad, drink; Compiles without error Trio triol new Trio salad sandwich, drink; Compiletime error Trio trio new Trio sandwich salad, salad; Compiletime error Write the complete Trio class below:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
