Algorithm for a solution that prints the amount of profit an organisation receives based on its sales. The more sales documented, the larger the profit ratio. Allow the user to input the total sales figure for the organisation. Compute the profit based on the following table. Display the sales and profit formatted with commas, decimals, and a rand symbol. Display the profit ratio formatted with a percent symbol. 0 – R1000: 3.0% / R1000.01 – R5000: 3.5% / R5000.01 – R10000: 4.0% / over R10000: 4.5%
Start
Declare variable double totalSales
Declare variable double profit=0
Declare variable double profitPerc=0
Read totalSales
if totalSales > 0 and totalSales <= 1000 then
Set profitPerc = 0.03
Set profit = totalSales *profitPerc
end if
if totalSales > 1000 and totalSales <= 5000 then
Set profitPerc = 0.035
Set profit = totalSales * profitPerc
end if
if totalSales > 5000 and totalSales <= 10000 then
Set profitPerc = 0.04
Set profit = totalSales * profitPerc
if totalSales > 10000 then
Set profitPerc = 0.045
Set profit = totalSales * profitPerc
end if
Display totalSales
Display profit
Stop
Comments
Leave a comment