In: Computer Science
IN C
Suppose a county tax collector collects property taxes on the
assessed value of each piece of property in their county. Here are
the tax collector's rules for taxes:
Assessed value is calculated at the rate of 75% of the property's actual value.
Homeowners who live at their property are provided with a $10,000 homeowner exception that further reduces their assessed value below the 75% level.
Homeowners are allowed to be billed in quarterly installments if they live at their property.
In the current year, suppose the property tax rate is $18.90 for each $1000 of assessed value.
Write a program that prompts for a property's actual value and whether it is owner-occupied for the homeowner's exception. Based on this information, calculate and display the assessed value, the tax owed and what each quarterly tax bill would be (if owner-occupied). The program dialogue is shown below.
In order to receive full credit, you must declare one or more const values and use a loop.
The round()function provided by math.h may be useful. Include it
with #include
Each iteration of the loop will process three inputs:
Property value
Homeowner exception
Whether or not to continue the loop
What is the property's actual value: 100000 Does the homeowner's exception apply (1=yes, 0=no): 0 Assessed value is: $75000.00 Property tax owed is: $1417.50 Quarterly tax option not available Do you want to continue [1=yes, 0=no]: 1 What is the property's actual value: 100000 Does the homeowner's exception apply (1=yes, 0=no): 1 Assessed value is: $65000.00 Property tax owed is: $1228.50 Quarterly tax owed is: $307.13 Do you want to continue [1=yes, 0=no]: 1 What is the property's actual value: 158000 Does the homeowner's exception apply (1=yes, 0=no): 1 Assessed value is: $108500 Property tax owed is: $2050.65 Quarterly tax owed is: $512.66 Do you want to continue [1=yes, 0=no]: 1 What is the property's actual value: 158000 Does the homeowner's exception apply (1=yes, 0=no): 0 Assessed value is: $118500.00 Property tax owed is: $2239.65 Quarterly tax option not available Do you want to continue [1=yes, 0=no]: 0
Below is the required program in C. All the explanation has been included inside the code using comments. If you still find any difficulty, please let me know.
#include
int main()
{
// variables
double propertyValue; // property value
int homeownerException; // whether it is home owner exception
int continueLoop; // to track whether to continue loop
double assessedValue; // Assessed value
double propertyTax; // Property Tax owed
double qtrlyTax; // Quaterly Tax owed
// constants
double ASS_RATE = 0.75; // Assessed value rate
int HO_EXCEPTION = 10000; // home owner exception
double TAX_RATE = 18.9/1000; // Tax rate $18.9 per $1000
// loop to iterate the steps
do{
// prompt and read the property's actual value
printf("\n\nWhat is the property's actual value: ");
scanf("%lf", &propertyValue);
// prompt and read if homeowner's exception apply
printf("Does the homeowner's exception apply (1=yes, 0=no): ");
scanf("%d", &homeownerException);
// calculate assessed value which is 75% of property's actual value
assessedValue = ASS_RATE*propertyValue;
// if homeowner's exception apply, reduce the assessed value further
if (homeownerException == 1)
{
assessedValue -= HO_EXCEPTION;
}
// display assessed value
printf("Assessed value is: $%.2f\n", assessedValue);
// calculate the property tax
propertyTax = TAX_RATE*assessedValue;
// display property tax owed
printf("Property tax owed is: $%.2f\n", propertyTax);
// calculate quarterly tax, if applied
qtrlyTax = propertyTax / 4;
// display quarterly tax
if (homeownerException == 1)
{
printf("Quarterly tax owed is: $%.2f\n", qtrlyTax);
}
else
{
printf("Quarterly tax option not available\n");
}
// ask if user want to continue
printf("Do you want to continue [1=yes, 0=no]: ");
scanf("%d", &continueLoop);
} while (continueLoop == 1);
return 0;
}
Sample Output