Write an object-oriented program in C# that takes a Pizza type and size as inputs. The program then should compute and print the price.
You will need the following for the program implementation.
1. A public class called Pizza with the following:
• A public attribute, of string type, called TypeofPizza. This attribute will hold four values (Vegetable, Margarita, Pepperoni, Napolitano).
• A public attribute, of char type, called SizeofPizza. This attribute will hold three values (S, M, and L), where S for Small, M for Medium, and L for Large.
• A method called CalculPrice to compute the price of the pizza, using the list prices below:
2. A main( ) method in the client class with following tasks:
• Declare an object called MyPizza of type Pizza class.
• Print the following messages for the user:
o “Please select yourpizza:”
o “1. Pizza Margarita”
o “2. Pizza Pepperoni”
o “3. Pizza Napolitano”
o “4. Pizza Vegetable”
• Read the pizza correspondent number and save it in a suitable declared variable.
• Print a message the asks the user to enter the pizza size
• Read the pizza size and save it in a suitable declared variable.
• Compute the price of the entered pizza by calling the method CalculPrice.
• Print a message that contains the name, the size and the price of the pizza.
1
Expert's answer
2012-10-31T09:53:28-0400
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment