In this example, we design an algorithm that calculates the sales tax and the price of an item sold in a particular state.
The sales tax is calculated as follows: The state’s portion of the sales tax is 4%, and the city’s portion of the sales tax is 1.5%. If the item is a luxury item, such as a car more than $50,000, then there is a 10% luxury tax.