Select Page

BTE 320 University of Miami C++ Program Computer Programming Task

Question Description

I’m working on a c++ practice test / quiz and need support to help me understand better.

Finish the question to output the same result as appleoutput.txt.quiz5question 2Problem=======Apple Inc. is pulling off a feat rarely seen in any industry, much less the cutthroat world of consumer electronics: gaining market share while also commanding higher prices.Led by the even more advanced features of iPhones it keeps introducting, and Apple’s management is now committed to analyzing sales even further to track how products are performing in different locations and even at different times of the year. The Apple regional offices report their monthly sales to Apple’s Headquarters who want to track the sales of each product for different periods at each location and sum it up in different ways. Apple will pull all sales data from different stores, and already have programs that summarize the data for each product per location per month. But they want more. They ask you to design an in memory cube that would take the numbers summarized at this level, and just do a quick POC (Proof Of Concept) that you could expand on later with more dimensions and with real transactional fact  data. The problem is that you have only half an hour before your meeting with Tim Cook. You must show him something. The VP for sales contacts you and gives you the following example of data, and example of output they would like to see, and asks you to use this sample for the POC demo. You must write code to make this happen. He even gives another exciting piece of information that Tim Cook thinks that Apple should have a product that would help people define multi dimensional data structures for analytical purposes – he thinks that in this day and age of Analytics and Big Data, Apple must compete with others who already have products to design those types of data structures (He sees no reason why apple should not add a cube design component and even a multi dimensional query language to some of their new acquisitions such as Foundation DB). You wonder to yourself: Hmmmm!!!…is he trying to compete with Microsoft Analysis Services in their MS SQL Server Product? You will think about this later, but right now, you have very little time, and you start thinking with yourimmediate manager of what you will demo. He had thought some of it through, though, but he wants you to finish it before the demo.Here is what your manager gives you (numbers should be in millions really), and asks  you to complete some of it while his other intern works on some of the easier functions.YOUR TASK IS TO WRITE FUNCTIONS 1,4,5,6 and 7,8 (5 points each). I did 2,3 for you as a guide.Produce a file similar to appleoutput.txt, but it does not have to be exact format. But somethingthat looks nice.Submission==========Don't change mainComplete the functions that you need to complete. The loops is what you need to do.Compile your codeg++ quiz5q2.cpp -o q5q2./q5q2 > myapplecube.txtsubmit your quiz5q2.cpp and your myapplecube.txt*/#include <iostream>#include <string>#include <iomanip>using namespace std;int const LOCATION_DIM_SZ = 2;int const TIME_DIM_SZ= 2;int const PRODUCT_DIM_SIZE= 3;string Location[]  = {"FL", "TX"};string Period[]   = {"Jan", "FEB"};string Product[]   = {"iPhone","iPad","MacBookPro"};/*1*/void printSalesDetails(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    int sum =0;        cout<<"Sales Details per Location per Period per Product" <<endl;    cout<<"================================================="<<endl;    for                 for                         for                                                                            }        }            }        cout<<"==================================================="<<endl;    }/*2*/void printSalesByProduct(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerProduct=0;        cout<<"Sales per Product" <<endl;    cout<<"================="<<endl;    for (i=0; i<3;i++){  //product        salesPerProduct = 0;        for (j=0 ; j<2;j++){ //location                        for (k=0; k<2;k++){ //period                                salesPerProduct += sales[j][k][i];                            }        }                cout << "Total Sales for " <<setw(20)<<setfill(' ')<<left<< Product[i] << "t=$" <<setw(9)<<setfill(' ')<<right<<fixed<<salesPerProduct<<setw(10)<<setfill(' ')<<left<<"tmillions"<<endl;            }            cout<<endl;    cout<<"==================================================="<<endl;        }/*3*/void printSalesByLocation(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerLocation=0;        cout<<"Sales per Location" <<endl;    cout<<"================="<<endl;            for (i=0; i<2;i++){  //location        salesPerLocation = 0;        for (j=0 ; j<2;j++){ //period                        for (k=0; k<3;k++){ //product                                salesPerLocation += sales[i][j][k];                            }        }                cout << "Total Sales for " <<setw(20)<<setfill(' ')<<left<< Location[i] << "t=$" <<setw(9)<<setfill(' ')<<right<<fixed<< salesPerLocation<<setw(10)<<setfill(' ')<<left<<"tmillions"<<endl;                            }            cout<<endl;    cout<<"==================================================="<<endl;        }/*4*/void printSalesByPeriod(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){    int i(0),j(0),k(0);    double salesPerPeriod=0;        cout<<"Sales per Period" <<endl;    cout<<"================="<<endl;               cout<<endl;    cout<<"==================================================="<<endl;    }/*5*/void printSalesPerProductPerLocation(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerProductPerLocation=0;        cout<<"Total Sales per Product per Location" <<endl;    cout<<"===================================="<<endl;                   cout<<endl;    cout<<"==================================================="<<endl;        }/*6*/void printSalesPerProductPerPeriod(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerProductPerPeriod=0;        cout<<"Total Sales per Product per Period" <<endl;    cout<<"===================================="<<endl;                cout<<endl;    cout<<"==================================================="<<endl;    }/*7*/void printSalesPerLocationPerPeriod(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerLocationPerPeriod=0;            cout<<"Total Sales per Location per Period" <<endl;    cout<<"===================================="<<endl;                               cout<<endl;    cout<<"==================================================="<<endl;    }/*8*/void printSalesPerPeriodPerLocation(double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]){        int i(0),j(0),k(0);    double salesPerPeriodPerLocation=0;    cout<<"Total Sales per Period per Location" <<endl;    cout<<"===================================="<<endl;                       cout<<endl;    cout<<"==================================================="<<endl;                }int main(int argc, const char * argv[]) {            double sales[LOCATION_DIM_SZ][TIME_DIM_SZ][PRODUCT_DIM_SIZE]={0};                sales[0][0][0]=45;    sales[0][0][1]=8;    sales[0][0][2]=4;    sales[0][1][0]=35;    sales[0][1][1]=10;    sales[0][1][2]=5;    sales[1][0][0]=75;    sales[1][0][1]=15;    sales[1][0][2]=13;    sales[1][1][0]=45;    sales[1][1][1]=17;    sales[1][1][2]=23.1;            printSalesDetails(sales);                       /* 1 */    printSalesByProduct(sales);                     /* 2 */    printSalesByLocation(sales);                    /* 3 */    printSalesByPeriod(sales);                      /* 4 */    printSalesPerProductPerLocation(sales);         /* 5 */    printSalesPerProductPerPeriod(sales);           /* 6 */    printSalesPerLocationPerPeriod(sales);          /* 7 */    printSalesPerPeriodPerLocation(sales);          /* 8 */    return 0; }
appleoutput.txt:Sales Details per Location per Period per Product=================================================sales for Location FL/Jan/iPhone       	=$    45.00	millions sales for Location FL/Jan/iPad         	=$     8.00	millions sales for Location FL/Jan/MacBookPro   	=$     4.00	millions sales for Location FL/FEB/iPhone       	=$    35.00	millions sales for Location FL/FEB/iPad         	=$    10.00	millions sales for Location FL/FEB/MacBookPro   	=$     5.00	millions sales for Location TX/Jan/iPhone       	=$    75.00	millions sales for Location TX/Jan/iPad         	=$    15.00	millions sales for Location TX/Jan/MacBookPro   	=$    13.00	millions sales for Location TX/FEB/iPhone       	=$    45.00	millions sales for Location TX/FEB/iPad         	=$    17.00	millions sales for Location TX/FEB/MacBookPro   	=$    23.10	millions Sum of Sales for all Apple              =$      295	millions ===================================================Sales per Product=================Total Sales for iPhone              	=$   200.00	millions Total Sales for iPad                	=$    50.00	millions Total Sales for MacBookPro          	=$    45.10	millions ===================================================Sales per Location=================Total Sales for FL                  	=$   107.00	millions Total Sales for TX                  	=$   188.10	millions ===================================================Sales per Period=================Total Sales for Jan               	=$160.00   	millions Total Sales for FEB               	=$135.10   	millions ===================================================Total Sales per Product per Location====================================Total Sales for	iPhone              in	FL     	=$    80.00	millions Total Sales for	iPhone              in	TX     	=$   120.00	millions Total Sales for	iPad                in	FL     	=$    18.00	millions Total Sales for	iPad                in	TX     	=$    32.00	millions Total Sales for	MacBookPro          in	FL     	=$     9.00	millions Total Sales for	MacBookPro          in	TX     	=$    36.10	millions ===================================================Total Sales per Product per Period====================================Total Sales for	iPhone              in	Jan    	=$   120.00	millions Total Sales for	iPhone              in	FEB    	=$    80.00	millions Total Sales for	iPad                in	Jan    	=$    23.00	millions Total Sales for	iPad                in	FEB    	=$    27.00	millions Total Sales for	MacBookPro          in	Jan    	=$    17.00	millions Total Sales for	MacBookPro          in	FEB    	=$    28.10	millions ===================================================Total Sales per Location per Period====================================Total Sales for	FL                  in	Jan    	=$    57.00	millions Total Sales for	FL                  in	FEB    	=$    50.00	millions Total Sales for	TX                  in	Jan    	=$   103.00	millions Total Sales for	TX                  in	FEB    	=$    85.10	millions ===================================================Total Sales per Period per Location====================================Total Sales for	Jan                 in	FL     	=$    57.00	millions Total Sales for	Jan                 in	TX     	=$   103.00	millions Total Sales for	FEB                 in	FL     	=$    50.00	millions Total Sales for	FEB                 in	TX     	=$    85.10	millions ===================================================

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now