Question: Please make program basic, were only on while and for loops A store sells three different items. Let us call these as Item A ,
Please make program basic, were only on while and for loops
A store sells three different items. Let us call these as Item A Item and Item Let the initial
stockcount of these items be Count Count and Count respectively. Customers keep buying
some of these items. Eventually, one or more of these items will run out of stockcount Write a Java
program that initially loads the counts of these three items, allows customers to buy these items and
indicates when an item or more than an item goes out of stock.
Programming requirements
You must read the values of Count Count and Count from input. You must validate the
counts each one must be positive
You must print the three stockscounts as soon as they are initialized.
Start a while loop. Inside the loop, read two inputs an item code or corresponding to
Item Item or Item respectively and the quantity of that item. You must validate the
item code and quantity must be positive This corresponds to a customer buying an item.
Reduce the stockcount of the corresponding item, ONLY IF the quantity the customer buys is
less than or equal to corresponding stockcount of that item. Otherwise, print a message saying
that there is not enough stockcount of that item.
Print the stockcount of each item after each transaction.
Terminate the while loop when all three counts become zero.
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
