1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

#include <iostream>
#include <iomanip>
#include <string>
using namespace std ;
float calc_HotDogs_Total (float[],int, float & , int &);
float calc_IceCream_Total (float[], int , int &);
float calc_Grand_Total (float , float );
void displayResults (int[], float[], float[] , float, float , float, int, int, float, int);
int main ()
{
const int NUM = 7;
float HotDogs_Sales[NUM], IceCream_Sales[NUM], HotDogs_Total_Sales = 0, IceCream_Total_Sales = 0, Grand_Total = 0, Most_Sold = 0;
int Days[NUM] , Max_IceCream_Sales = 0, Day2 ;
cout << " ************* NUMBER OF HOT DOGS ************* \n" << endl;
for ( int i = 0 ; i < NUM; i ++ )
{
Days[i] = i+1 ;
}
for (int i = 0 ; i < NUM ; i ++)
{
cout << " Please enter number of hot dogs sold: " ; cin >> HotDogs_Sales[i] ;
}
cout << "\n************* NUMBER OF Ice Cream ************* \n " << endl;
for ( int i = 0 ; i < NUM ; i++)
{
cout << " Please enter number of ice cream sold: " ; cin >> IceCream_Sales[i];
}
HotDogs_Total_Sales = calc_HotDogs_Total ( HotDogs_Sales, NUM , Most_Sold , Day2 );
IceCream_Total_Sales = calc_IceCream_Total ( IceCream_Sales, NUM , Max_IceCream_Sales);
Grand_Total = calc_Grand_Total ( IceCream_Total_Sales, HotDogs_Total_Sales );
displayResults (Days, IceCream_Sales, HotDogs_Sales, IceCream_Total_Sales, HotDogs_Total_Sales , Grand_Total, NUM, Max_IceCream_Sales, Most_Sold, Day2 ) ;
return 0 ;
}
float calc_HotDogs_Total ( float HotDogs_Sales[] ,int NUM, float &Most_Sold , int& Day2 )
{
float HotDogs_Total_Sales = 0 ;
HotDogs_Sales ;
for (int i = 0 ; i < NUM ; i++ )
{
HotDogs_Total_Sales = HotDogs_Sales[i] + HotDogs_Total_Sales ;
}
for (int i = 0 ; i < NUM ; i++ )
{
if (HotDogs_Sales[i] > Most_Sold )
{
Most_Sold = HotDogs_Sales[i];
Day2 = i + 1 ;
}
}
return HotDogs_Total_Sales ;
}
float calc_IceCream_Total ( float IceCream_Sales[], int NUM , int &Max_IceCream_Sales)
{
float IceCream_Total_Sales = 0 ;
IceCream_Sales;
Max_IceCream_Sales = 0 ;
for ( int i = 0 ; i < NUM ; i++ )
{
IceCream_Total_Sales = IceCream_Sales[i] + IceCream_Total_Sales ;
if (IceCream_Sales[i] >= 250)
{
Max_IceCream_Sales = Max_IceCream_Sales + 1;
}
}
return IceCream_Total_Sales ;
}
float calc_Grand_Total ( float IceCream_Total_Sales, float HotDogs_Total_Sales )
{
float Grand_Total = IceCream_Total_Sales + HotDogs_Total_Sales ;
return Grand_Total ;
}
void displayResults (int Days[], float HotDogs_Sales[], float IceCream_Sales[], float IceCream_Total_Sales, float HotDogs_Total_Sales , float Grand_Total, int NUM, int Max, float Most_Sold , int Day_Sold )
{
cout << setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(2);
cout << "\n\n\t\tLittle League Ball Park " << endl ;
cout << " \t\t Sales Report\t\t" << endl ;
cout << "\t\tWeek of June 12, 2011\t\t\n\n" << endl;
cout << setw(15) << " Day "<< setw(15) << " Ice Cream " << setw(15) << " Hot Dogs " << endl ;
cout << setw(15) << "  "<< setw(15) << "  " << setw(15) << "  " << endl ;
for ( int i = 0 ; i < NUM ; i++ )
{
cout << setw(15) << Days [i] << setw(14) << HotDogs_Sales[i] << setw(14) << IceCream_Sales[i] << endl ;
}
cout << "\n\n\tGrand Total = $" << Grand_Total << endl;
cout << "\n\tWeekly total of ice cream sales is = $"<< IceCream_Total_Sales << endl;
cout << "\n\tWeekly total of hot dogs sales is = $" << HotDogs_Total_Sales << endl ;
cout << "\n\tDay Number # "<< Day_Sold << " sold the most Hot Dogs = $ " << Most_Sold << endl ;
cout << "\n\tIce Cream sales was over $250 " << Max << " time this week\n\n " << endl ;
return;
}
 