Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.
  2. 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.
  3. 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

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions