+ 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
1 Antwort
+ 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