Answer to Question #221012 in C++ for Kefilwe Mamabolo

Question #221012
You are requested by a SuperStore (Spar) in Soshanguve to calculate it’s earning for the week (the store opens the entire week) and determine the day with the highest and lowest earnings. The Store comprises of two sections namely the Food section and the Liquor store.
Your C++ program should prompt the total sales for each section for each day and store the total sales for the day into an array. At the end of the week It should display a report for Management for the total sales for that week, the day the lowest sales and the day with the highest sales were recorded.
1
Expert's answer
2021-07-28T06:06:48-0400




#include <iostream>


using namespace std;




int main()
{
    
    string week [7] = {"Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday","Sunday"};
    int Liquor_store[7];
    int food_section[7];
   int total_sales[7];
    for(int i = 0; i<7; i++){
        cout<<"Enter the sales for food section for day "<<(i+1)<<endl;
        cin>>food_section[i];
        cout<<"Enter the sales for Liquor store for day  "<<(i+1)<<endl;
        cin>>Liquor_store[i];
        total_sales[i] = food_section[i] + Liquor_store[i];
    }
    int max=total_sales[0];
   for(int i=0; i<7; i++){
       if(total_sales[i]>max){
           max = total_sales[i];
       }
       
   }
   int min =total_sales[0];
   for(int i=0; i<7; i++){
       if(min > total_sales[i]){
           min = total_sales[i];
       }
   }
   int indexMax=0;
   int indexMin = 0;
   for(int i =0; i<7; i++){
       if(total_sales[i]== max){
           indexMax = i;
       }
       else if(total_sales[i]==min){
           indexMin = i;
       }
   }
 cout<<"A report for Management for the total sales for the week \n"<<endl;
 cout << "The day with the highest sales recorded:  "<<week[indexMax]<<endl;
  cout << "The day with the lowest sales is:        "<<week[indexMin]<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS