Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Due Feb 19 by 1:30pm Points 10 Announcements Assignments Discussions Problem Description Grades People Pages Files Write a program that simulates a vending machine. The

image text in transcribed
Due Feb 19 by 1:30pm Points 10 Announcements Assignments Discussions Problem Description Grades People Pages Files Write a program that simulates a vending machine. The vending machine sells three types of food: 1) Potato chips $1.25; 2) Cookies $0.85; 3) Candies $0.95. The program will prompt for the buyer to enter the amount in quarters (25 cents), dimes (10 cents), and nickels (5 cents). The machine does not take dollar or cents. The program will then present a selection menu for the foods. The buyer makes a selection. If the buyer selects a food that is sold out, the program will display a message and re-display the selection menu. If the buyer has put in enough money, the selected food will be dispensed, with a message "Please take a your (food)". If the amount is more than the cost, an appropriate amount of change (in quarter, dime or nickel) will be dispensed. Every food is initialized with a quantity. The quantity is reduced by one every time the food is dispensed. When the quantity of a food is 0, no more should be sold, with an error stating "Sold out. Please make another choice" Syllabus 1998 Quizzes Modules Conferences Note: Collaborations NetTutor I dollar = 4 quarters - 10 dimes - 20 nickels 1 dollar = 4 quarters 1 quarter 2 dimes + 1 nickel = 5 nickles 25 cents 1 dime = 2 nickels = 10 cents Requirements Please do all of the following: 1. Draw a flow chart depicting the algorithm. 2. Create a CH source code file named Vending Machine.cpp. Make sure the file compile correctly. 3. Test your program with the following test cases: 3.1. Buyer selects a food that is available, and inserts the exact amount as the price 3.2 Buyer selects a food that is in stock, and inserts less money than the price: 3.3 Buyer selects a food that is in stock, and inserts more money than the price: 3.4 Buyer selects a food that is sold our 3.5 Buyer selects a food that does not exist. Repeat the test cases for all the foods. Capture the interactions and save ir a file. 4. Submit all of the following

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

Beginning PostgreSQL On The Cloud Simplifying Database As A Service On Cloud Platforms

Authors: Baji Shaik ,Avinash Vallarapu

1st Edition

1484234464, 978-1484234464

More Books

Students also viewed these Databases questions

Question

to encourage a drive for change by developing new ideas;

Answered: 1 week ago

Question

4 What are the alternatives to the competences approach?

Answered: 1 week ago