اذهب إلى المحتوى
  • 0

وين الخطأ

صدام العمري

السؤال

Com Emp :: Com Emp (string f, string l, double sales ):Employee (f, l)                            { set Sales (sales);

 

} void Com Emp :: set Sales (double sa l) { if( sa l > =10000) sales = sa l; else sales = 5000; }

 

 double Com Emp:: get Earnings() const{ if(sales>99999) return .13 * sales; else return

 

 .1 * sales ; } void Com Emp::print () const { cout <<"Commission Employee\t"

 

; Employee: :print(); cout<< "\ tgets \t"<< get Earnings ()< < endl; }

 

# ifndef COMEMP_H #define COMEMP_H #include "Employee"; class

 

 Com Emp :public Employee { private: double sales; public:  Com Emp

 

(string = "No ",string = "Body", double = 10000 ); void set Sales (double); double

 

Get Earnings() const; void print()const; }; # endif // COMEMP_H

 

: #include "Employee.h" Employee:: Employee() { fname = "No"; l name = "Body"; }

 

 Employee::Employee(string f, string l) { set Employee(f, l); }; void

 

 Employee::set Employee(string f, string l name){ fname = f; this->l name = l name; }

 

void Employee::print() const{ cout<<fname<<'\t'<<l name; }

 

#ifndef EMPLOYEE_H #define EMPLOYEE_H

 

 #include< iostream > using

 

 namespace std ; #include "string"; class Employee { private: string fname; string

 

 l name; public: Employee(); Employee(string, string); void set Employee(string

 

, string); virtual void print() const; }; #endif // EMPLOYEE_H

 

#include "Sal Emp.h"; #include "Com Emp.h"; int main() { Employee nil; nil .print();

 

 

"Hello world!" << endl; Sal Emp Hamzah("Hamzah", "Alsheikh", 1672); Com Emp

 

Bian  ("Bian ", "Hazem", 75365); Hamzah. print(); Bian .print(); Employee * empptr;

 

cout<<"\n___________\n"; empptr = & Raed ; empptr->print(); cout<<"\n___________\n"; empptr = &Hamzah; empptr->print(); cout<<"\n___________\n"; empptr = &Bian; empptr->print(); return 0;

 

#include "Sal Emp.h"; #include "Com Emp.h"; int main() { Employee nil; nil .print();

 

cout<<endl; Employee Raed("Raed", "Hassan"); Raed. print(); cout<<endl; cout <<

 

"Hello world!" << endl; Sal Emp Hamzah("Hamzah", "Alsheikh", 1672); Com Emp

Bian ("Bian", "Hazem", 75365); Hamzah .print (); Bian .print(); Employee * empptr;

cout<<"\n___________\n"; empptr = &Raed; empptr->print();

 

cout<<"\n___________\n"; empptr = &Hamzah; empptr->print();

 

cout<<"\n___________\n"; empptr = &Bian; empptr->print(); return 0

 

 #ifndef SALEMP_H

 #define SALEMP_H

#include "Employee.h"; class

 

 Sal Emp: public Employee { private: double salary; public: Sal Emp(string = "No",

 

 string = "Body", double = 260); void set Sal(double); double get Earnings()const; void

 

print() const; }; #endif // SALEMP_H

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...