Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question: Write a program that will read monthly sales into a dynamicallyallocat

ID: 3618712 • Letter: Q

Question

Question:

Write a program that will read monthly sales into a dynamicallyallocated array. The program will input the size of the array fromthe user. It will call a function that will find the yearlysum (the sum of all the sales). It will also call another functionthat will find the average.

What I have so far:

#include "stdafx.h"
#include<conio.h>
#include<stdlib.h>
int main()
{

    double dTotalSales=0.0;
    int i=0,j=0;
  
    for(i=0;i<6;i++)
    {
     
           cout<<"monthly "<<(j+1)<<" : ";
           cin>>companyMonthlySales[i][j];
           cout<<endl;
        }
    }
    clrscr();
    cout<<"***************** Sales Report***************************** ";
    for(j=0;j<4;j++)
    {
       cout<<"     Month "+(j+1)<<": ";      
        dTotalSales = 0.0;
        highestSales = 0;
        for(i=0;i<6;i++)
        {
           dTotalSales = dTotalSales +companyMonthlySales[i][j];           
           if(j==0)
           {
               cout<<" Monthly "<< (i+1) << " : Sales ="<<companyMonthlySales[i][j]<<" ";
               cout<<" "<< "Sales Increased by : Prev Quarter datanot avaialable ";
               highestSales=1;
           }
           else
           {
               cout<<" Monthly "<< (i+1) << " : Sales ="<<companyMonthlySales[i][j]<<" ";
               double nDiff = (double)companyMonthlySales[i][j] -(double)companyMonthlySales[i][j-1];
               int nPerDiff = (int) ((nDiff/(double)companyDivSales[i][j-1]) *100);
               cout<<" "<< "Sales Increased by :"<<nPerDiff<<"% ";
               if(companyMonthlySales[i][j] > companyMonthlySales[i][j-1])
               highestSales = i;  
           }
        }
    cout<<" "<< " Total
     Sales: "<<dTotalSales<<" ";
        if(j == 0)
        {
           cout<<" "<< "Company Sales Increased by : PrevQuarter data not avaialable ";
        }
        else
        {
           double nDiff = dTotalSales - dPrevTotalSales;
           int nPerDiff = (int) ((nDiff/dPrevTotalSales) * 100);
           cout<<" "<< "Company Sales Increased by :"<<nPerDiff<<"% ";
        }
        cout<<" "<< "Avearge Sales per Division :"<<(dTotalSales/6)<<" ";
      
        dPrevTotalSales =dTotalSales;
    }
    return 0;
}

Explanation / Answer

#include #include #include #include float* sales; int count; float yearlySum() {    float sum = 0.0;     for(int i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote