Question
In the country of Pythonia, the income tax standard deduction is 10,000 PYD (Pythonese Dollars) per person. Nondeductible household income (everything in excess of the standard deduction) is subject to 5% tax for the first 100,000 PYD and 11.258% tax above the first 100,000 PYD. Write a program that shall calculate income tax in Pythonia. The program shall ask the user about the household income (in PYD) and the number of members in the household an report the tax, rounded to the nearest PYC (Pythonese Cents). For example, if the household income is 256,000 PYD and there are three people in the household, the program shall report 20485.08 PYD. If the calculated tax is zero or negative, the program shall report that no tax is due. Implementation suggestions: Write a program that checks if any tax is due at all. Write a program that calculates flat 5% tax on the nondeductible income, regardless of the amount. Write the complete program.
Explanation / Answer
#include #include using std::cout; using std::cin; using std::setprecision; using std::fixed; int main(){ double price_without_taxes, amount_in_kg, tax_percent, total; cout amount_in_kg; cin.ignore(); cout > tax_percent; cin.ignore(); total = (1 + tax_percent / 100) * price_without_taxes * amount_in_kg; cout