The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 401 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
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. To calculate the price of the item, we need to calculate the state’s portion of the sales tax, the city’s portion of the sales tax, and, if it is a luxury item, the luxury tax. Suppose sale Price denotes the selling price of the item, state Sales Tax denotes the state’s sales tax, city Sales Tax denotes the city’s sales tax, luxury Tax denotes the luxury tax, sales Tax denotes the total sales tax, and amount Due denotes the final price of the item.
To calculate the sales tax, we must know the selling price of the item and whether the item is a luxury item.
The state Sales Tax and city Sales Tax can be calculated using the following formulas:
State Sales Tax = sale Price . 0.04
City Sales Tax = sale Price . 0.015
Next, you can determine luxury Tax as follows:
if (item is a luxury item)
luxury Tax = sale Price .0.1
otherwise
luxury Tax = 0
Next, you can determine sales Tax as follows:
Sales Tax = state SalesTax + city SalesTax + luxury Tax
Finally, you can calculate amountDue as follows:
amountDue = salePrice + salesTax
The algorithm to determine salesTax and amountDue is, therefore:
1. Get the selling price of the item.
2. Determine whether the item is a luxury item.
3. Find the state’s portion of the sales tax using the formula:
stateSalesTax = salePrice .0.04
4. Find the city’s portion of the sales tax using the formula:
City Sales Tax = sale Price .0.015
5. Find the luxury tax using the following formula:
if (item is a luxury item)
luxury Tax = sale Price . 0.1
other wise
luxury Tax = 0
6. Find salesTax using the formula:
salesTax = state Sales Tax + city Sales Tax + luxury Tax
7. Find amountDue using the formula:
Amount Due = sale Price + sales Tax
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll