You are required to write an interactive C++ program that will manage and monito
ID: 3746545 • Letter: Y
Question
You are required to write an interactive C++ program that will manage and monitor an inventory system for 7 days. Initial Value and Inputs • You should start with at least 3 different items (label them as Item-1, Item-2, and Item-3) 30 of each as starting values. • Each day, customers select (buy) different quantity from each items based on their needs. The customer should provide the data as inputs. Program Requirements: • Program must be written interactively menu and request proper data from the user (customer). • Considering the transactions, each day you must report (print) the total sale of each item and the available number. • For each item, if the inventory less than 20%, you should order and make sure to maintain the level of each inventory at 30 each. • Report (print) the status of each item at the end of 7 days. • The program should be fully documented. • Test your program for different set of data. • You should submit (hard copy and digital) the source code, executable file, and properly labeled output.
Explanation / Answer
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
//variable declaration
int item1,item2,item3,ch;
int q1,q2,q3,qty,i;
int total_tea,total_coffee,total_biscuit;
total_tea=0;
total_coffee=0;
total_biscuit=0;
q1=0;
q2=0;
q3=0;
item1=30;
item2=30;
item3=30;
//loop for seven days a week
for(i=1;i<=7;i++){
do{
cout<<endl;
//menu for the user
cout<<"Welcome to the Store"<<endl;
cout<<"Items available are"<<endl;
cout<<"Product Quantity"<<endl;
cout<<"Tea "<<item1<<endl;
cout<<"Coffee "<<item2<<endl;
cout<<"Biscuit "<<item3<<endl;
cout<<"Press 1 to buy Tea"<<endl;
cout<<"Press 2 to buy Coffee"<<endl;
cout<<"Press 3 to buy Biscuit"<<endl;
cout<<"Press 4 to Exit"<<endl;
cout<<"Enter your choice"<<endl;
cin>>ch;
//accepting user choice
if(ch==1)
{
cout<<"Enter the quantity you want to buy"<<endl;
cin>>qty;
total_tea=total_tea+qty;
q1=qty;
item1=item1-q1;
}
if(ch==2)
{
cout<<"Enter the quantity you want to buy"<<endl;
cin>>qty;
total_coffee=total_coffee+qty;
q2=qty;
item2=item2-q2;
}
if(ch==3)
{
cout<<"Enter the quantity you want to buy"<<endl;
cin>>qty;
total_biscuit=total_biscuit+qty;
q3=qty;
item3=item3-q3;
}
}while(ch!=4);
cout<<endl;
//displaying daily sales report
cout<<"Sales at the end of Day "<<(i)<<endl;
cout<<"Tea sold "<<q1<<endl;
cout<<"Tea left "<<item1<<endl;
cout<<"Coffee sold "<<q2<<endl;
cout<<"Coffee left "<<item2<<endl;
cout<<"Biscuit sold "<<q3<<endl;
cout<<"Biscuit left "<<item3<<endl;
cout<<endl;
//if the stock goes below 20%
if(item1<6)
item1=30;
if(item2<6)
item2=30;
if(item3<6)
item3=30;
q1=0;
q2=0;
q3=0;
qty=0;
}
//displaying the weekly report
cout<<"Report For the Whole Week"<<endl;
cout<<"Total Tea Sold "<<total_tea<<endl;
cout<<"Total Coffee Sold "<<total_coffee<<endl;
cout<<"Total Biscuit Sold "<<total_biscuit<<endl;
cout<<"Tea Left "<<item1<<endl;
cout<<"Coffee Left "<<item2<<endl;
cout<<"Biscuit Left "<<item3<<endl;
}
OUTPUT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.