Need help on the arrays project =[

Can anyone please help me out on this program..

Objective: The purpose of this project is to expose you to: One Dimensional arrays, input/output of arrays and manipulating arrays.
Problem Specification: 
The Little League Ball Park sells Hot Dogs and Ice-cream. During the week of June 12th, the dollar sales were as follows:

Day Hot Dogs Ice-cream
        
1   $112    $93
2   $94     $325
3   $105    $225
4   $92     $71 
5   $239    $98
6   $442    $298
7   $537    $333

Program Requirements:
a.  Create separate arrays for hot dogs and ice cream by inputting the values into the arrays from the keyboard. "Do your input in main"

b.  Calculate the sales in dollars for the week for hot dogs and ice cream.

c.  Compute the grand total of sales for the week for both hot dogs and ice cream.

d.  Find the day and amount that the most hot dogs was sold.

e.  Count how many times in this week ice cream sold more than $250 in a day.

-----------
Output of the program is the following report

            Little League Ball Park
                 Sales Report
            Week of June 12,2011

Day    Hot Dogs     Ice-cream
---    --------     ---------
1      $112.00      $ 93.00  
2      $ 94.00      $325.00
3      $105.00      $225.00   
4      $ 92.00      $ 71.00
5      $239.00      $ 98.00 
6      $442.00      $298.00 
7      $537.00      $333.00

Totals $xxx.xx      $xxx.xx 

Grand Total = $xxxx.xx

Day Number: # Sold the most Hot Dogs =

Number of times in a week that ice cream sold more than $250 in a day is:

------------
The Program should contain the following functions:
1. Separate functions are used to calculate total sales for the week for each item sold.
2. A function is used to find the day and amount where the most hot dogs soda is sold.
3. A function is used to count how many times in this week ice cream sold more than $250 in a day.
4. A function is used to print the headings
5. At least one function is used to print the information.


Also need help with Flowchart or Psuedocode and hierarchical chart.. !!
Last edited on
please try for yourself first and i'll be glad to help when you get stuck...

well i m stuck from the beginning lolz
im completely lost ..

*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main ()
{
const int NUM = 7;
float HotDogs_Sales[NUM], IceCream_Sales[NUM] ;
float HotDogs_Total_Sales, IceCream_Total_Sales ;
int Days[NUM] = { 1,2,3,4,5,6,7 } ;


for ( int i= 0; i <= NUM ; i ++ )
{
Days[i] ;
}


for ( int i = 0; i <= NUM ; i ++)
{
cout << "please enter number of hot dogs sold" ;
cin >> HotDogs_Sales[i] ;
}

for ( int i = 0 ; i <= NUM ; i ++ )
{
cout << "please enter number of ice cream sold" ;
cin >> IceCream_Sales[i];
}

im working on this program in Visual Studio rite now and im stuck need more help please...!!
Last edited on
Your program looks good so far. Now you just need to find the total of each array, find the max of each array, and check how many members of IceCream_Sales are greater than 250. Is it functions that you don't understand?
Last edited on
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{

const int NUM = 6;
int Days[NUM] ;
float HotDogs_Sales[NUM], IceCream_Sales[NUM] ;
float HotDogs_Total_Sales, IceCream_Total_Sales ;

float calc_HotDogs (float HotDogs_Sales, int NUM);

for ( int i= 0; i <= NUM; i ++ )
{
Days[i] ;
}

for ( int i = 0; i <= NUM; i ++)
{
cout << "please enter number of hot dogs sold:" ;
cin >> HotDogs_Sales[i] ;
}

for ( int i = 0; i <= NUM; i ++ )
{
cout << "please enter number of ice cream sold:" ;
cin >> IceCream_Sales[i];
}
}

float calc_HotDogs( float HotDogs_Sales, int NUM )
{
float HotDogs_Total_Sales = 0 ;

for ( int i = 0; i <= NUM; i ++ )
{
HotDogs_Total_Sales = HotDogs_Total_Sales + HotDogs_Sales[i] ;
}


[ I am having problem with the calculations...when i add hotdogs_sales[i]]
Last edited on
1
2
3
4
5
6
7
8
9
10
float calc_HotDogs( float HotDogs_Sales[], int NUM )
{
   float HotDogs_Total_Sales = 0 ;

   for ( int i = 0; i <= NUM; i ++ )
   {
      HotDogs_Total_Sales = HotDogs_Total_Sales + HotDogs_Sales[i] ;
   }
   return HotDogs_Total_Sales;
}


Your first parameter is only a float, it needs to be an array. Also, I don't know if you're returning the final total.
Last edited on
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
    
	const int NUM = 6;
    int Days[NUM] ;
	float HotDogs_Sales[NUM], IceCream_Sales[NUM] ;
    float HotDogs_Total_Sales, IceCream_Total_Sales ;
  
	float calc_HotDogs (float HotDogs_Sales, int NUM);

	for ( int i= 0; i <= NUM; i ++ )
		{
			Days[i] ;
		}
	
	for ( int i = 0; i <= NUM; i ++)
		{
			cout << "please enter number of hot dogs sold:" ;
			cin >> HotDogs_Sales[i] ;
		}

	for ( int i = 0; i <= NUM; i ++ )
		{
			cout << "please enter number of ice cream sold:" ;
			cin >> IceCream_Sales[i];
		}
}

float calc_HotDogs( float HotDogs_Sales, int NUM )
{
	float HotDogs_Total_Sales = 0 ;

	for ( int i  = 0; i <= NUM; i ++ )
	{
		HotDogs_Total_Sales = HotDogs_Total_Sales + HotDogs_Sales[i] ;
		return HotDogs_Total_Sales;
	}

}

No its still not working, if i take out [i] from "HotDogs_Sales[i] " then it works but i do need to include [i] to calculate....
Last edited on
Check my previous post, I edited it. You need to pass in an array, not just a float. Also, make sure you return the total after the for loop, so you have the total calculated.
Last edited on
Topic archived. No new replies allowed.