Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Program Help

TheFreeForAllTheFreeForAll Posts: 7Member
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

Sign In or Register to comment.