Program Help

I need help making this program work
It does not run the way it should

[code]
//Weelsville Wholesale Company Exam By Brian Kaufman 6/1/06

#include
#include
#include

//Write struct
struct EmployeeType
{
EmployeeType();
vectorName;
vectorEarnings;
double CommissionRate;
double CommissionEarned;
};
//---------------------------------------------------------
//Struct Constructor
EmployeeType::EmployeeType()
:Name(10),
Earnings(10)
{
}
//--------------------------------------------------------
//Function Prototypes
void LoadEmployees(EmployeeType & Employee);
void CalculateEarnings(EmployeeType & Employee);
void WriteData(EmployeeType & Employee);
//--------------------------------------------------------
int main()
{
EmployeeType Employee;
LoadEmployees(Employee);
WriteData(Employee);
return(0);
}
//---------------------------------------------------------
void LoadEmployees(EmployeeType & Employee)
{
for(int i=0;i<10;i++)
{
cout<<"Enter Employee "<<i<<"'s Last Name:";
cin>>Employee.Name[i];
cout<<"Enter Earnings:";
cin>>Employee.Earnings[i];
}
}
//-----------------------------------------------------------
void CalculateEarnings(EmployeeType & Employee)
{
for(int i=0;i<10;i++)
{
if((Employee.Earnings[i]>0)&&(Employee.Earnings[i]<1001))
{
Employee.CommissionRate=.03;
}
else if((Employee.Earnings[i]>1000)&&(Employee.Earnings[i]<5001))
{
Employee.CommissionRate=.045;
}
else if((Employee.Earnings[i]>5000)&&(Employee.Earnings[i]<10001))
{
Employee.CommissionRate=.0525;
}
else
{
Employee.CommissionRate=.06;
}

Employee.CommissionEarned=Employee.CommissionRate*Employee.Earnings[i];
}
}
void WriteData(EmployeeType & Employee)
{
for(int i=0;i<10;i++)
{
cout<<"Name Sales Commission Rate Commission Earned"<<endl;
cout<<Employee.Name[i]<<" "<<Employee.Earnings[i]<<" "<<Employee.CommissionRate<<" "<<Employee.CommissionEarned<<endl;
}
}
[code]

Comments

  • : I need help making this program work
    : It does not run the way it should
    :

    Is this a guessing game? What are the problems?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion