# Untitled

Sep 8th, 2016
1,176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //------------------------------------------------------------------------------------------------------------------------------
2. //                                                                  Exercise 8
3. //                                                                  ----------
4. //
5. // General : The program will get details about the employee and calculate his salary with them.
6. //
7. // Input   : Base salary, seniority, number of children, working hours, and bonuses.
8. //
9. // Process : The program considers all the known details about the employee, and calculates his salary by them and by the rules of the company.
10. //
11. // Output  : Prints the employee salary.
12. //
13. //------------------------------------------------------------------------------------------------------------------------------
15. // Date: 9.9.2016
16. //------------------------------------------------------------------------------------------------------------------------------
17.
18. #include <stdio.h>
20. #define seniority_bonuos_time 10
21. void main(void)
22. {
23.     float base_salary;
24.     float seniority;
25.     float num_of_children;
26.     float working_hours;
27.     float TY, TB, T160, T175;
29.     scanf_s("%f", &base_salary);
31.     scanf_s("%f", &seniority);
32.     printf("Please enter number of children:");
33.     scanf_s("%f", &num_of_children);
34.     printf("Please enter the number of hours: ");
35.     scanf_s("%f", &working_hours);
37.     scanf_s("%f", &TY);
39.     scanf_s("%f", &TB);
41.     scanf_s("%f", &T160);
43.     scanf_s("%f", &T175);
44.
45.     if (seniority > seniority_bonuos_time)
46.     {
47.         base_salary = seniority_add*base_salary + base_salary;
48.     }
49.     if (num_of_children > 3)
50.     {
51.         base_salary = (6 - num_of_children > 0)*((int)num_of_children % 3)*TY + base_salary;
52.         base_salary = (num_of_children - 6 > 0)*(num_of_children - 6)*TB + base_salary;
53.
54.     }
55.     if (working_hours > 160)
56.     {
57.         int extra_hours = working_hours - 160;
58.         base_salary = (extra_hours - 15 > 0)*(extra_hours - 15)*T175 + (extra_hours - 15 > 0) * 15 * T160 + base_salary;
59.         base_salary = (extra_hours - 15 < 0)*(extra_hours - 15)*T160*(-1) + base_salary;
60.     }
61.     printf("your salary is %.2f", base_salary);
62.
63.
64.
65.
66. }