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 ME SOLVE THE PROBLE, THE TOPIC IS TOO LONG SO I HAVE TO TYPE IN QUESTION, PLEASE READ MY WHOLE QUESTION AND WRITE CODE INC 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 (vending-config.txt)
The first line of the file indicates how many coins of each denomination (U.S.) are provided, e.g.:
100300200500
Indicates that the machine has 100 quarters, 300 dimes, 200 nickels, and 500 pennies. The vending machine will
not be configured to hold more than 10,000 coins of a given denomination.
The values for each type of coin are the standard, in US dollars: 0.25 for quarters, 0.10 for dimes, 0.05 for nickels,
and 0.01 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, e.g.:
4
The third line onward each include four entries per line: a two-letter 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 200 items
of any given type.
For example:
In a given configuration, the name of an item will not exceed 50 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 $5.00. 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 two-letter code for an attempted purchase and the amount of money paid.
An example of some lines of input are as follows:
A22.50
B11.78
Z9-6.00
A140.00
Note: for these purchases, assume that a gift card is being used -- the vending machine does not collect any coins at all, it merely consumes the amount on the card, and dispenses change.
More requirements:
Processing must include logging the results of each attempted purchase to a text file, vending-out.txt. For each purchase, the log must include the item code, nam, cost, amount paid, and other results.
IN the case of a rejected purchase, output the status in a human-readable format; in cases where a purchase was successful, include output of coins returned.
Each purchase attempt results in exactly one these statuses based on processing:
1if the amount paid is less than the cost, log "insufficient-funds"
2if there are no more items reamaining, log "insufficient-supply"
3if the code entered is invalid, log "invalid-code". The code check should be case-insensititve, i.e. lookup for "A5"is the same as"a5"
4if the amount paid is over the limit,log "over-payment"
5if there is not enough change in the machine to complete the purchase, log"no-change"
6ifan item is successfully purchased:
A. Indicate success
B. report the amount of change returned
C. report how many coins of each denomination are returned
D. update the vending machine by
I. Removing one of the items purchased
II. removing amounts of couns returned as change.
III. Incrementung a total number of items sold
IV. adding the amount of the purchase to total sales.
At the start and end of the log file, your code must also log the state of the vending machine:
1A list each item for sale by code and name and the amount remaining
2amount of each coun remaining in the system
3total amount of sales
4a count of how many purchases were attempted
5how many purchases were successful
6A count and histogram by percentage of successful purchases by product
* Note that the sum of counts for requirement 6 must be the same as the count in requirement 5
Refer to vending-out.txt for an example of acceptable program output.
At a minimum, your program should report the following steps to stdout:
- loading the vending machine configuration
- processing the purchases
-logfileprogram complete
At a minimum, your submission must include a main.c file, a vending.c file, and a vending.h file. These files should contain code and type declarations as appropriate. The main.c should contain only preprocessor directives needed to run the program and an implementation of the main() function.
Your submission must include all header(.h) and source(.c) files needed to compile and run the code.
You may include your vending-out.txt file, but your grade will be beased onmy execution of your code using different vending machine configurations and sets of purchases.

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 Finance Questions!