Question: In C# Implement a set of classes for dining out that will demonstrate polymorphism. An abstract Restaurantclass will have abstract methods such as GetMenu, GetBill,

In C#

Implement a set of classes for dining out that will demonstrate polymorphism. An abstract Restaurantclass will have abstract methods such as GetMenu, GetBill, OrderFood, PayBill, and so on. Implement an EatOut method by calling the abstract methods in the order they would occur in a typical restaurant scenario. Implement FastFood, CoffeeShop, and Fancy derived classes of Restaurant which implement all the abstract methods, using stubs to print messages describing what would happen in that type of restaurant. For example, the OrderFood method in the FastFood class might describe talking to a machine from a car window in a drive-through line, and the OrderFood method in the Fancy class might call a method to order wine to go with the meal. To demonstrate the polymorphism, declare several restaurant objects that refer to the various derived classes. Calling the EatOut method for each restaurant will show that each behaves in its own way, appropriate to that type of restaurant. A derived class may override the EatOut method if the order of method calls defined in the EatOut method in the Restaurant class is not appropriate for that derived class.

Your main calling function should look something like this:

public static void DoEx10_13()

{

Restaurant fast = new FastFood();

fast.EatOut();

Restaurant coffee = new CoffeeShop();

coffee.EatOut();

Restaurant fancy = new FancyRestaurant();

fancy.EatOut();

}In C# Implement a set of classes for dining out that will

Your output should look something like this:

The fast food resant Look at the menu above you I'd like a taco and a cola That will be $2.50 Customer hands the cashier a five-dollar bill and gets change This is good with hot sauce The coffee shop Here are your menus I'd like the fish special with rice This is good with tartar sauce May I have the check, please? Customer hands the cashier a twenty-dollar bill and gets change This is the fancy restaurant Here are your menus I'd like the lobster Newburg and a glass of your best Chardonnay The wine has a fine bouquet Waiter places a folder with the check enclosed on the table Customer places a credit card inside the folder The fast food resant Look at the menu above you I'd like a taco and a cola That will be $2.50 Customer hands the cashier a five-dollar bill and gets change This is good with hot sauce The coffee shop Here are your menus I'd like the fish special with rice This is good with tartar sauce May I have the check, please? Customer hands the cashier a twenty-dollar bill and gets change This is the fancy restaurant Here are your menus I'd like the lobster Newburg and a glass of your best Chardonnay The wine has a fine bouquet Waiter places a folder with the check enclosed on the table Customer places a credit card inside the folder

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!