Question: C++ You are creating a program for a JellyBelly factory to keep up with jellybean inventory. Your program will load current inventory from a text
C++ You are creating a program for a JellyBelly factory to keep up with jellybean inventory. Your program will load current inventory from a text file and then allow the user to choose from a menu. The user may print the inventory, add to inventory, delete from inventory, or save the inventory and exit the program.
You will create one structure named Jellybean that will hold the following information about a kind of jellybean:
Flavor (Example: A&W Root Beer)
Color: (Example: brown)
Star rating from consumers (Example: 4.5)
Price per pound of this kind (Example: 8.99)
Quantity (in pounds) in stock (Example: 480)
Below you will find details of what should happen in each function. Make sure to follow the specifications!
FUNCTION: MAIN
Create a 50-element Jellybean array.
You will need an integer variable that will keep track of how many jellybean kinds are in inventory at the current time.
Load the inventory. All jellybean kinds that are currently in inventory (in stock) are written in jellybellyinventory.txt Your program will read the text file within a loop, placing each piece of data in the correct element of the structure array. [provided for you]
Call the displayMenuGetChoice function to display the menu and get the users choice. Your program should continue to do this until the user chooses #5.
Call the appropriate function based on the users choice.
If they chose 1, call the printAllInventory function.
IF they chose 2, call the printColor function
If they chose 3, call the addBeans function
If they chose 4, call the deleteBeans function
Save all data in the Jellybean array to the text file jellybellyInventory.txt. Each piece of data should be separated by a * character so that it can then be read again by the program at a later date.
This function is provided for you and aids in reading the data from the file by converting strings to numbers so that the numbers can be placed in the structure member that has a number data type.
FUNCTION: DISPLAYMENUGETCHOICE
This function should print the menu, get the users choice, validate the users choice, and then return the users choice. Here is what the menu should look like:
This function should print all data currently stored in the Jellybean structure in a readable way.
This function should first ask the user what color jellybeans they want to print from inventory. It should then print out all the possible colors: beige, black, brown, blue, green, multi-colored, orange, pink, purple, red, white, and yellow. Then, read in the users color choice. Then, print all jellybean kinds from the Jellybean array that are of that color. If there were no jellybean types in inventory of that color then print Sorry, there were no jellybean types in inventory with that color.
This function will allow the user to add a new type of jellybean. Allow the user to enter in the flavor, color, rating, price per pound, and quantity in pounds. You should make sure this function adds one to the current number of jellybean kinds in inventory and return the updated number of kinds from this function.
This function will allow the user to delete or remove a kind of jellybean from inventory. If a kind was successfully removed, then make sure this function subtracts one from the current number of jellybean kinds in inventory. Return the updated number of kinds from this function.
jellybelly.h
jellybelly.cpp
functions.cpp
jellybellyinventory.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
