Question: IN C# Create an abstract class called Sandwiches that has a sandwich name, type, price and number of ordered sandwiches. It also has respective auto-implemented
IN C#
- Create an abstract class called "Sandwiches" that has a sandwich name, type, price and number of ordered sandwiches. It also has respective auto-implemented properties for all fields apart from the price, where its property checks whether the assigned value is positive or not. If a negative number is assigned as a price, the program should display a warning message. The class also contains a method called "GetSandwichInfo" that displays the name and type of the sandwich. Moreover, the class implements an interface called "IBuyable" that has a method called "CalculatePrice" and accept two parameters; a sandwich price and number of sandwiches.
- Create a child class called "SignatureSandwiches" that has a constructor that requires passing all fields (name, type, price and number of sandwiches ordered), and an implementation of the abstract method it inherits.
- In the Main method, instantiate two objects from the "SignatureSandwiches" class and invokethe "GetSandwichInfo" and "CalculatePrice" methods by passing the appropriate list of parameters.
Sample output :
Sandwich ordered is Meat Based and its name is Cheese Burger
Total Price is 13.50
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
