Program displaying wrong resullts

this program is supposed to take in sales figures in dollars, convert them into a salary for the salesmen, and then display the number of salaries that fall within certain ranges (200-299 ect.)
However i keep getting incorrect results
no matter what i enter i keep getting 11 for the range 200-299 and 40 for the range over 1000
i would appreciate help finding the problem

here is the code for the 3 files

sales.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Class automatically generated by Dev-C++ New Class wizard

#ifndef SALESREPORT_H
#define SALESREPORT_H

// No description
class SalesReport
{
	public:
		// class constructor
		SalesReport( int [] );
		int Salary( int );
		void DisplaySalary();
		
	private:
        int sales[50];   // sales
};

#endif // SALESREPORT_H 


sales.cpp
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
// Class automatically generated by Dev-C++ New Class wizard
#include <cstdlib>
#include "salesreport.h" // class's header file
#include <iostream>
#include <iomanip>
using namespace std;

SalesReport::SalesReport(int sArray[]) 
{
    
	DisplaySalary();
}

int  SalesReport::Salary( int oneSales )
{
          return  static_cast<int> ((oneSales* .09) + 200);
    
   //return sales;
}
// End Salary

void SalesReport::DisplaySalary()
{
     int arraysize = sizeof(sales)/sizeof(int);
    
     int rangeA=0, rangeB=0 , rangeC=0, rangeD=0, rangeE=0, rangeF=0, rangeG=0, rangeH=0, rangeI=0;
     for (int i =0; i <= arraysize; i++)
     {    
          int salary = Salary( sales[i] );
           if (200 <= salary && salary <= 299)  
            rangeA += 1;
           
           
           else if (300 <= salary && salary <= 399)  
            rangeB += 1;
     
            
            else if (400 <= salary && salary <= 499)  
             rangeC += 1;
        
            
            else if (500 <= salary && salary <= 599)  
             rangeD += 1;
   
            
            else if (600 <= salary && salary <= 699)  
            rangeE += 1;
      
            
            else if (700 <= salary && salary <= 799)  
            rangeF += 1;
     
            
            else if (800 <= salary && salary <= 899)  
            rangeG += 1;
      
            
            else if (900 <= salary && salary <= 999)  
            rangeH += 1;
  
            
            else 
            rangeI += 1;
   
            }
            // End while statement
            
        
        cout << "    Range         Number" << endl;
        cout << " $200-299         " << rangeA << endl;
        cout << " $300-399         " << rangeB << endl;  
        cout << " $400-499         " << rangeC << endl;
        cout << " $500-599         " << rangeD << endl;
        cout << " $600-699         " << rangeE << endl; 
        cout << " $700-799         " << rangeF << endl; 
        cout << " $800-899         " << rangeG << endl;
        cout << " $900-999         " << rangeH << endl;
        cout << " $1000 and over   " << rangeI << endl; 
        
     
        }
        // End Display Salary        
              
              


main.cpp
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
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include "salesreport.h"
using namespace std;

int main()
{
   
    int i = 0;
     int sales[i];
    cout << "Enter a sales amount  (negative to end): ";
    cin >> sales[i];
    while( sales[i] >= 0 )
    {
          cout << endl;
          i++;
          cout << "Enter a sales amount  (negative to end): ";
          cin >> sales[i];
     } 

SalesReport mySalesReport( sales );


system("PAUSE");
return(0);
}
Topic archived. No new replies allowed.