1 out of 3 rated this helpful - Rate this topic

C/C++ Build Errors

This section is an alphanumeric reference of the error messages generated by the build tools. To get help on a particular error message, either click the mouse on an error number in the Output window and press F1, or type the error number in the Look for box in the Index.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
constructor with return type, or illegal redefinition of current class-name
first when i created the program it was working fine. things start happening when i added my second bit of code. its keep showing me lots of errors. can any one help me please? i highlighted my second bit of code by using bold and italic font. please help asap

#include<iostream>

usingnamespace std;

 

class employee

{

private:

      char name[20];

      char id[15];

      double hourRate;

 

public:    

      void setDetails()

      {

            cout<<"Employee name: ";

            cin>>name;

            cout<<"Employee ID: ";

            cin>>id;

                 

      }

 

      void setRate()

      {

      cout<<"Hourly Rate: ";

      cin>>hourRate;

 

      }

 

      double calculatewage()

      {

      double wage;

      double hours = 37.5;

      wage=hourRate*hours*0.85;

      return wage;

      };

 

      class hourlyDetails: public employee

      {

            private:

            double hourlyDetails;

           

 

      public:

            void setDetails()

            {

                  employee::setDetails();

            }

 

            void setRate()

            {

                  cout<<"Hourly Salary: "<<endl;

                  cin>>hourlyDetails;

            }

 

      double calculatewage()

      {

      double wage;

      double hours = 40;

      wage=hourRate*hours;

      return wage;

      }

     

      double tax_calculation()

      {

                  double tax;

                  double hours: 40;

                  double tax = 0.15;

                  double taxdeducted;

                  taxdeducted = hourlyRate*hours*tax*

                        return taxdeducted;

      };

     

      class yearlySalary: public employee

      {

            private:

            double yearlySalary;

      }

 

      public:

            void setDetails()

            {

                  employee::setDetails();

            }

 

            void setRate

            {

                  cout<<"Yearly Salary: "<<endl;

                  cin>>hourlyDetails;

            }

 

            double calculatewage()

      {

      double wage;

      wage=yearlySalary/52*tax;

      return wage;

      };

 

      void main()

 

      {

      double totalwage;

      double pay1,pay2,pay3;

 

      employee employee1;

      employee employee2;

      employee employee3;

      cout<<""<<endl;

 

      employee1.setDetails();

      employee1.setRate();

      pay1=employee1.calculatewage();

      cout<<""<<endl;

 

 

      employee2.setDetails();

      employee2.setRate();

      pay2 = employee2.calculatewage();

      cout<<""<<endl;

 

 

      employee3.setDetails();

      employee3.setRate();

      pay3=employee3.calculatewage();

      cout<<""<<endl;

 

      totalwage=pay1+pay2+pay3;

      cout<<"Total Pay After Tax: "<<totalwage<<endl;

 

 

 

      char practice[100];

      cin.getline(practice,100);

 

      char myline1[100];

      cin.getline(myline1,100);

      }


please help
first when i created the program it was working fine. things start happening when i added my second bit of code. its keep showing me lots of errors. can any one help me please? i highlighted my second bit of code by using bold and italic font. please help asap

#include<iostream>

usingnamespace std;

 

class employee

{

private:

      char name[20];

      char id[15];

      double hourRate;

 

public:    

      void setDetails()

      {

            cout<<"Employee name: ";

            cin>>name;

            cout<<"Employee ID: ";

            cin>>id;

                 

      }

 

      void setRate()

      {

      cout<<"Hourly Rate: ";

      cin>>hourRate;

 

      }

 

      double calculatewage()

      {

      double wage;

      double hours = 37.5;

      wage=hourRate*hours*0.85;

      return wage;

      };

 

      class hourlyDetails: public employee

      {

            private:

            double hourlyDetails;

           

 

      public:

            void setDetails()

            {

                  employee::setDetails();

            }

 

            void setRate()

            {

                  cout<<"Hourly Salary: "<<endl;

                  cin>>hourlyDetails;

            }

 

      double calculatewage()

      {

      double wage;

      double hours = 40;

      wage=hourRate*hours;

      return wage;

      }

     

      double tax_calculation()

      {

                  double tax;

                  double hours: 40;

                  double tax = 0.15;

                  double taxdeducted;

                  taxdeducted = hourlyRate*hours*tax*

                        return taxdeducted;

      };

     

      class yearlySalary: public employee

      {

            private:

            double yearlySalary;

      }

 

      public:

            void setDetails()

            {

                  employee::setDetails();

            }

 

            void setRate

            {

                  cout<<"Yearly Salary: "<<endl;

                  cin>>hourlyDetails;

            }

 

            double calculatewage()

      {

      double wage;

      wage=yearlySalary/52*tax;

      return wage;

      };

 

      void main()

 

      {

      double totalwage;

      double pay1,pay2,pay3;

 

      employee employee1;

      employee employee2;

      employee employee3;

      cout<<""<<endl;

 

      employee1.setDetails();

      employee1.setRate();

      pay1=employee1.calculatewage();

      cout<<""<<endl;

 

 

      employee2.setDetails();

      employee2.setRate();

      pay2 = employee2.calculatewage();

      cout<<""<<endl;

 

 

      employee3.setDetails();

      employee3.setRate();

      pay3=employee3.calculatewage();

      cout<<""<<endl;

 

      totalwage=pay1+pay2+pay3;

      cout<<"Total Pay After Tax: "<<totalwage<<endl;

 

 

 

      char practice[100];

      cin.getline(practice,100);

 

      char myline1[100];

      cin.getline(myline1,100);

      }


Advertisement