Quarterly earnings calculator

Question

Suppose a company is taxed 20% if earnings for a given quarter are > = $3M USD.

If earnings land < $3M USD for the quarter, the company is taxed at a lower rate of 15%.

Write a function using Python to calculate both the pre-tax and post-tax earnings for a given company, with the ability to feed in the # of widgets sold as well as the average price of the widget as inputs (# of widgets sold * avg. price of widgets = total earnings in this case).

For example, if the company sells 20,000 widgets at an average price of $220 USD then your function should return:

  • Pre-tax earnings were 20,000*220 = 4.4M for the quarter.
  • Post-tax earnings were 3.52M for the quarter [4.4M *.8 (since we fall in higher 20 percent tax bracket here)]

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now