Calculate for the wages of a sales man if the wage is calculated at the rate of 15%. If the sales man has been with the company | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Calculate for the wages of a sales man if the wage is calculated at the rate of 15%. If the sales man has been with the company

Calculate for the wages of a sales man if the wage is calculated at the rate of 15%. If the sales man has been with the company for more than 3years, he has a loyalty bonus of 10% of his calculated wage

3rd Feb 2017, 8:10 AM
sally
sally - avatar
1 Answer
+ 1
I'm not the best with pseudocode, I would do this differently depending on what language I was using and/or whether or not I was using objects, which may defeat the purpose of pseudocode.(maybe not though) either way I hope this helps if i was not using objects I would use a function like this: calculateWage(sales, yearsWorked) wage = sales * 0.15 if yearsWorked > 3 loyaltyBonus = wage * 0.1 wage = wage + loyaltyBonus return wage if i was using objects i would use the same function but i would pass in a salesMan object instead of the two others, where the salesMan object would have properties for sales and yearsWorked, so my function would look like this: calculateWage(salesMan) wage = salesMan.sales * 0.15 if salesMan.yearsWorked > 3 loyaltyBonus = wage * 0.1 wage = wage + loyaltyBonus return wage
3rd Feb 2017, 9:06 AM
Bill
Bill - avatar