Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<locale.h>
- using namespace std;
- const int Week_Work_Hours = 40;
- const double Salary_Per_Hour = 10.0;
- struct Worker
- {
- char name[32];
- int hours_per_week;
- double salary;
- };
- void calculate_salary(Worker worker1)
- {
- if(worker1.hours_per_week <= Week_Work_Hours)
- {
- worker1.salary=(worker1.hours_per_week*Salary_Per_Hour)-((worker1.hours_per_week*Salary_Per_Hour)*(20/100));
- cout<<"Çàïëàòàòà íà "<<worker1.name<<" ñ "<<worker1.hours_per_week<<" ðàáîòíè ÷àñà å:"<<worker1.salary<<"ëâ."<<endl;
- }
- else if(worker1.hours_per_week > Week_Work_Hours && worker1.hours_per_week <= Week_Work_Hours+3)
- {
- worker1.salary=(worker1.hours_per_week*Salary_Per_Hour)+((worker1.hours_per_week*Salary_Per_Hour)*(5/100));
- cout<<"Çàïëàòàòà íà "<<worker1.name<<" ñ "<<worker1.hours_per_week<<" ðàáîòíè ÷àñà å:"<<worker1.salary<<"ëâ."<<endl;
- }
- else if(worker1.hours_per_week <= Week_Work_Hours+5)
- {
- worker1.salary=(worker1.hours_per_week*Salary_Per_Hour)+((worker1.hours_per_week*Salary_Per_Hour)*(8/100));
- cout<<"Çàïëàòàòà íà "<<worker1.name<<" ñ "<<worker1.hours_per_week<<" ðàáîòíè ÷àñà å:"<<worker1.salary<<"ëâ."<<endl;
- }
- else if(worker1.hours_per_week <= Week_Work_Hours+10)
- {
- worker1.salary=(worker1.hours_per_week*Salary_Per_Hour)+((worker1.hours_per_week*Salary_Per_Hour)*(7/100));
- cout<<"Çàïëàòàòà íà "<<worker1.name<<" ñ "<<worker1.hours_per_week<<" ðàáîòíè ÷àñà å:"<<worker1.salary<<"ëâ."<<endl;
- }
- else// if(worker1.hours_per_week > Week_Work_Hours+10)
- {
- worker1.salary=(worker1.hours_per_week*Salary_Per_Hour)+((worker1.hours_per_week*Salary_Per_Hour)*(6/100));
- cout<<"Çàïëàòàòà íà "<<worker1.name<<" ñ "<<worker1.hours_per_week<<" ðàáîòíè ÷àñà å:"<<worker1.salary<<"ëâ."<<endl;
- }
- }
- int main()
- {
- setlocale(LC_ALL, "Bulgarian");
- Worker worker1[5];
- unsigned int n;
- cout<<"Âúâåäè îò 3 äî 5 ðàáîòíèêà:"<<endl;
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cout<<"Âúâåäè èìå íà ðàáîòíèê:"<<endl;
- cin>>worker1[i].name;
- cout<<"Âúâåäè áðîé ðàáîòåíè ÷àñîâå ñåäìè÷íî:"<<endl;
- cin>>worker1[i].hours_per_week;
- }
- for(int i=0;i<n;i++)
- {
- calculate_salary(worker1[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement