Question: PLEASE HELP M E SOLVE THE PROBLE, THE TOPIC I S TOO LONG S O I HAVE T O TYPE I N QUESTION, PLEASE READ
PLEASE HELP SOLVE THE PROBLE, THE TOPIC TOO LONG I HAVE TYPE QUESTION, PLEASE READ WHOLE QUESTION AND WRITE CODE COMPLETE, THANK YOU
Build a vending machine
To complete this project, you may work alone or with one other student in this section.
All coding must be completed and submitted by the end of class.
Your program must use the data in the configuration file vendingconfig.txt
The first line of the file indicates how many coins of each denomination US are provided, eg:
Indicates that the machine has quarters, dimes, nickels, and pennies. The vending machine will
not be configured to hold more than coins of a given denomination.
The values for each type of coin are the standard, in US dollars: for quarters, for dimes, for nickels,
and for each penny.
The second line in the configuration file gives a count of how many different items are for sale in the vending
machine, eg:
The third line onward each include four entries per line: a twoletter code indicating the slot for the item, the
name of the item for sale, its cost in dollars, and the amount of each item. There will not be more than items
of any given type.
For example:
In a given configuration, the name of an item will not exceed characters.
Please pay attention to these requirements:
There is no predefined limit on how many different items are on sale in a given vending machine. This must
be dynamically allocated at run time.
The vending machine does not accept any payments over $ If more than this amount is attempted, the
purchase is rejected due to overpayment.
Once the vending machine is configured, your code must output the initial state of the vending machine,
including which items it has for sale and all details for them and how many coins of each denomination it has.
Following configuration, your code must process the purchases.txt file, which has a collection of entries
indicating a twoletter code for an attempted purchase and the amount of money paid.
An example of some lines of input are as follows:
Note: for these purchases, assume that a gift card being used the vending machine does not collect any coins all, merely consumes the amount the card, and dispenses change.
More requirements:
Processing must include the results each attempted purchase a text file, vendingout. For each purchase, the must include the item code, nam, cost, amount paid, and other results.
the case a rejected purchase, output the status a humanreadable format; cases where a purchase was successful, include output coins returned.
Each purchase attempt results exactly one these statuses based processing:
the amount paid less than the cost, "insufficientfunds"
there are more items reamaining, "insufficientsupply"
the code entered invalid, "invalidcode". The code check should caseinsensititve, lookup for the same
the amount paid over the "overpayment"
there not enough change the machine complete the purchase, change"
item successfully purchased:
Indicate success
report the amount change returned
report how many coins each denomination are returned
update the vending machine
I. Removing one the items purchased
removing amounts couns returned change.
III. Incrementung a total number items sold
adding the amount the purchase total sales.
the start and end the file, your code must also the state the vending machine:
list each item for sale code and name and the amount remaining
mount each coun remaining the system
otal amount sales
count how many purchases were attempted
many purchases were successful
count and histogram percentage successful purchases product
Note that the sum counts for requirement must the same the count requirement
Refer vendingout. for example acceptable program output.
a minimum, your program should report the following steps stdout:
loading the vending machine configuration
processing the purchases
rogram complete
a minimum, your submission must include a main. file, a vending. file, and a vending. file. These files should contain code and type declarations appropriate. The main. should contain only preprocessor directives needed run the program and implementation the main function.
Your submission must include all header and source files needed compile and run the code.
You may include your vendingout. file, but your grade will beased execution your code using different vending machine configurations and sets purchases.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
