### HELP ASAP!!!

Suppose you own a soft drink distributorship that sells Coca-Cola(ID number 1), Pepsi (ID number 2), Canada Dry (ID number 3), and Hires (ID number 4) by the case. Write a program to do the following

a. Read in the case inventory for each brand at the start of the week.
b. Process all weekly sales and purchase records for each brand.
c. Display the final inventory.

Each transaction will consist of two data items. The first will be the brand identification number an integer. The second will be the amount purchased (a positive integer), or the amount sold (a negative integer. You can assume that you always have sufficient foresight to prevent depletion of your inventory for any brand.

I'm not asking for somebody to solve it for me I just don't know where to begin. Can someone sort of just get me started and point me in the right direction and I should be able to take it from there. I just don't no where to begin. This is all I have and I don't even know it is right

 ``12345678910111213141516171819202122232425262728`` ``````#include #include using namespace std; int main() { //variables int coca, pepsi, canada, hires; cout << "Enter inventory for Coca-Cola: "; cin >> coca; cout << "Enter inventory for Pepsi: "; cin >> pepsi; cout << "Enter inventory for Canada: "; cin >> canada; cout << "Enter inventory for Hires: "; while (pepsi } ``````
Well, the amount purchased or the amount sold is the difference of the starting inventory versus the ending inventory.
I'll give you a start.
You started by providing the ID's.
1-Coca-Cola
2-Pepsi
4-Hires
Then you are told that each transactions had two parts to it. 1- Have the ID number of your soda be identified in a variable. 2- Have a amount purchased or sold of such said soda.
After that you assume you have infinite amounts of each brand( =D cool).
SOOOO Lets draw this out on a program.
You'll first need to declare your variables which will represent the sodas.
`int coca, pepsi, canada, hires;`
Then get the inventory.
 ``12345678`` `````` cout << "Enter inventory for Coca-Cola: "; cin >> coca; cout << "Enter inventory for Pepsi: "; cin >> pepsi; cout << "Enter inventory for Canada: "; cin >> canada; cout << "Enter inventory for Hires: "; cin<< hires;``````

Then make something that will be able to identify what soda is being used for the transaction. Maybe a switch statement could be nice?
 ``12345`` ``````switch(sodaID) case: 1//coca case: 2//pepsi case: 3//canada case: 4//hires ``````

Then figure out a way to use those cases to modifying the values already given when the person inputted inventory amounts.
Then if you want you can loop the thing with a while loop or w.e. If you need more help then say so.

PS. I'm not quite sure how into c++ you already are so if you need an example with something that's not switch statements then just say so.
Last edited on
Sorry the very late response. Thank you for the help so far but I am comfortable with the switch I'm just not understanding whether I need to do any calculations or not. and also would I have to declare the sodaID with the other variables or should I make another function and put the switch statement there
Topic archived. No new replies allowed.