fork download
  1. // Renee V. Lopez CS1A Chapter 3, P. 145, #14
  2. /*******************************************************************************
  3.  
  4.  * CALCULATE SENIOR PROPERTY TAX
  5.  * _____________________________________________________________________________
  6.  * This program determines the annual property tax for senior homeowners by
  7.  * applying a $5,000 exemption and calculates the quarterly payment based on
  8.  * the resulting annual tax.
  9.  * _____________________________________________________________________________
  10.  * INPUT
  11.  * propVal - The total value of the property
  12.  * taxRate - The tax rate applied per $100 of assessed value
  13.  *
  14.  * OUTPUT
  15.  * propTax - The annual property tax amount after applying the senior
  16.  * exemption
  17.  * quarterPay - The amount due each quarter based on the annual property tax
  18.  *
  19.  ******************************************************************************/
  20. #include <iostream>
  21. #include <iomanip> // For formatting output to two decimal places
  22. using namespace std;
  23.  
  24. int main()
  25. {
  26. // Variable declarations for input
  27. float propVal; // The value of the property
  28. float taxRate; // The tax rate per $100 of assessed value
  29.  
  30. // Variable declarations for output
  31. float assessedVal; // The assessed value of the property
  32. float propTax; // The calculated annual property tax after the exemption
  33. float quarterPay; // The amount of tax due each quarter
  34.  
  35. // Define the senior citizen exemption amount
  36. const float SENIOR_EXEMP = 5000.0;
  37.  
  38. // Prompt user for input values
  39. cout << "Enter the value of your house: ";
  40. cin >> propVal;
  41. cout << "Enter the tax rate per $100 of assessed value: ";
  42. cin >> taxRate;
  43.  
  44. // Compute the assessed value of the property
  45. assessedVal = propVal * 0.6;
  46.  
  47. // Calculate the annual property tax after applying the exemption
  48. propTax = ((assessedVal - SENIOR_EXEMP) / 100) * taxRate;
  49.  
  50. // Compute the quarterly tax payment
  51. quarterPay = propTax / 4;
  52.  
  53. // Output the results with two decimal places
  54. cout << fixed << setprecision(2); // Ensure two decimal places in output
  55. cout << "Your annual property tax is $" << propTax << ".\n";
  56. cout << "Your quarterly tax bill is $" << quarterPay << ".\n";
  57.  
  58. return 0;
  59. }
  60.  
Success #stdin #stdout 0.01s 5280KB
stdin
34859
12
stdout
Enter the value of your house: Enter the tax rate per $100 of assessed value: Your annual property tax is $1909.85.
Your quarterly tax bill is $477.46.