using c# 5.0 Create a program that allows the user to fill a vending machine and purchase items from it. The program should use a Stack to implement last-in-first-out (LIFO) behavior. The vending machine always vends the item that was most recently added to it. The user should be able to stock an item in the machine or buy an item from the machine. The program should inform the user if the machine is empty when they attempt a purchase. Sample Program Run After your program runs, the console should look similar to the following example. The exact output will vary depending on what the user inputs. Vending Machine Do you want to (A - Add Item, B - Buy Item, E - End): A Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Sprite Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Sprite Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Dr Pepper Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Dr Pepper Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Coke Do you want to (A - Add Item, B - Buy Item, E - End): B There are no items in the vending machine Do you want to (A - Add Item, B - Buy Item, E - End): E Thank you for using the vending machine!
using c# 5.0 Create a program that allows the user to fill a vending machine and purchase items from it. The program should use a Stack to implement last-in-first-out (LIFO) behavior. The vending machine always vends the item that was most recently added to it. The user should be able to stock an item in the machine or buy an item from the machine. The program should inform the user if the machine is empty when they attempt a purchase. Sample Program Run After your program runs, the console should look similar to the following example. The exact output will vary depending on what the user inputs. Vending Machine Do you want to (A - Add Item, B - Buy Item, E - End): A Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Sprite Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Sprite Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Coke Do you want to (A - Add Item, B - Buy Item, E - End): A Dr Pepper Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Dr Pepper Do you want to (A - Add Item, B - Buy Item, E - End): B You bought a Coke Do you want to (A - Add Item, B - Buy Item, E - End): B There are no items in the vending machine Do you want to (A - Add Item, B - Buy Item, E - End): E Thank you for using the vending machine!
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
using c# 5.0
Create a program that allows the user to fill a vending machine and purchase items from it.
The program should use a Stack to implement last-in-first-out (LIFO) behavior. The vending machine always vends the item that was most recently added to it.
The user should be able to stock an item in the machine or buy an item from the machine.
The program should inform the user if the machine is empty when they attempt a purchase.
Sample Program Run
After your program runs, the console should look similar to the following example. The exact output will vary depending on what the user inputs.
Vending Machine
Do you want to (A - Add Item, B - Buy Item, E - End): A
Coke
Do you want to (A - Add Item, B - Buy Item, E - End): A
Coke
Do you want to (A - Add Item, B - Buy Item, E - End): A
Sprite
Do you want to (A - Add Item, B - Buy Item, E - End): B
You bought a Sprite
Do you want to (A - Add Item, B - Buy Item, E - End): B
You bought a Coke
Do you want to (A - Add Item, B - Buy Item, E - End): A
Dr Pepper
Do you want to (A - Add Item, B - Buy Item, E - End): B
You bought a Dr Pepper
Do you want to (A - Add Item, B - Buy Item, E - End): B
You bought a Coke
Do you want to (A - Add Item, B - Buy Item, E - End): B
There are no items in the vending machine
Do you want to (A - Add Item, B - Buy Item, E - End): E
Thank you for using the vending machine!
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education