Advertisement
satishfrontenddev5

Untitled

Feb 18th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ABC Corporations Pvt Ltd wants to build a sales organization where each executive manages two subordinates with an efficient budget. The Managing Director plans to reward the line with the highest sales with a bonus, split into budget efficiency and sales efficiency portions. The bonus is 3 million Rupees, with 25% based on budget efficiency (subordinates managed) and 75% based on individual sales. Write a program to identify the line with the highest sales and distribute bonuses accordingly.
  2.  
  3. Organizational Structure:
  4. - Sales executives (SE1 to SE17) manage sales in millions of INR.
  5.  
  6. Program Objective:
  7. - Identify the line with the highest sales.
  8. - Distribute bonuses:
  9.   - 25% based on budget efficiency (number of subordinates managed).
  10.   - 75% based on individual sales performance.
  11.  
  12. Example:
  13. - List the line with the highest sales.
  14. - Distribute bonuses to executives based on budget and sales efficiency.
  15.  
  16.  
  17.  
  18. Problem Statement:
  19. ABC Corporations Pvt Ltd wants to reward the sales organization line that achieved the highest sales in the year. The reward distribution is based on budget efficiency and sales figures. Each sales executive manages two subordinates from top to bottom with an efficient budget. If there isn't enough budget for two people, only one person can be hired at any level.
  20.  
  21. Approach:
  22. 1. Calculate the total sales handled by each sales executive.
  23. 2. Determine the organization line with the highest total sales.
  24. 3. For the chosen line:
  25.   - Distribute 25% of the bonus based on budget efficiency.
  26.   - Distribute 75% of the bonus based on individual sales figures.
  27. 4. Output the organization line with the highest sales and the bonus distribution for each member.
  28.  
  29. JavaScript Code Snippet Solution:
  30.  
  31. ```javascript
  32. // Sales data representing millions in INR handled by each sales executive
  33. const salesData = {
  34.  SE1: 10,
  35.  SE2: 8,
  36.  SE3: 7,
  37.  SE4: 9,
  38.  SE5: 11,
  39.  SE6: 7,
  40.  SE7: 8,
  41.  SE8: 6,
  42.  SE9: 10,
  43.  SE10: 5,
  44.  SE11: 7,
  45.  SE12: 6,
  46.  SE13: 9,
  47.  SE14: 5,
  48.  SE15: 6,
  49.  SE16: 8,
  50.  SE17: 4
  51. };
  52.  
  53. // Calculate total sales for each sales executive
  54. const totalSales = Object.values(salesData).reduce((acc, cur) => acc + cur, 0);
  55.  
  56. // Determine the organization line with the highest total sales
  57. const highestSalesLine = Object.keys(salesData).filter(se => salesData[se] === Math.max(...Object.values(salesData)));
  58.  
  59. // Output the organization line with the highest sales
  60. console.log('Organization Line with the Highest Sales:', highestSalesLine);
  61.  
  62. // Individual bonus distribution for the chosen line
  63. const bonus = 3000000; // Total bonus amount
  64. const budgetEfficiencyReward = 0.25 * bonus; // 25% of bonus for budget efficiency
  65. const salesEfficiencyReward = 0.75 * bonus; // 75% of bonus for sales efficiency
  66.  
  67. // Number of subordinates managed by each sales executive
  68. const subordinates = {
  69.  SE1: 5,
  70.  SE2: 4,
  71.  SE5: 3,
  72.  SE9: 2,
  73.  SE16: 1,
  74.  SE17: 0
  75. };
  76.  
  77. // Calculate budget efficiency reward distribution
  78. const budgetEfficiencyBonus = highestSalesLine.reduce((acc, se) => {
  79.  return acc + (subordinates[se] / Object.values(subordinates).reduce((acc, cur) => acc + cur, 0)) * budgetEfficiencyReward;
  80. }, 0);
  81.  
  82. // Calculate sales efficiency reward distribution
  83. const salesEfficiencyBonus = highestSalesLine.reduce((acc, se) => {
  84.  return acc + (salesData[se] / totalSales) * salesEfficiencyReward;
  85. }, 0);
  86.  
  87. // Output bonus distribution
  88. console.log('Budget Efficiency Reward Distribution:', budgetEfficiencyBonus);
  89. console.log('Sales Efficiency Reward Distribution:', salesEfficiencyBonus);
  90. ```
  91.  
  92. This solution first calculates the total sales for each sales executive, determines the organization line with the highest sales, and then calculates the bonus distribution for that line based on budget efficiency and sales figures. Finally, it outputs the organization line with the highest sales and the bonus distribution for each member.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement