# solution

Allen Countyâ€™s Property Tax Administrator wants an application that calculates the amount of property tax owed based on a propertyâ€™s assessed value. Seven different tax rates are involved in the calculation. Each tax rate is per \$100 of assessed value. The state rate is .124, the county rate is .096, and the school rate is .557. The remaining four rates are for special services as follows: ambulance is .1, health is .038, library is .093, and soil conservation is .02. The application should display each tax and the total tax.

a. List the output, processing (if any), and input items, and then create an appropriate algorithm.

b. Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Allen Property Solution and Allen Property Project. Save the application in the ClearlyVB2012Chap06 folder. Change the name of the form file on your disk to frmMain.vb. If necessary, change the formâ€™s name to frmMain.

c. Create a suitable interface. Include an Exit button.

d. Code the Exit buttonâ€™s Click event procedure and the problemâ€™s algorithm. Be sure to use the TryParse method. Use the Decimal data type for the variables and named constants. Display the state, county, school, ambulance, health, library, and soil conservation taxes with two decimal places. Display the total property tax with a dollar sign and two decimal places.

e. Save the solution and then start the application. Test the application using 105000 as the assessed value. The total property tax should be \$1,079.40.

f. Now test the application using 121920 as the assessed value. Notice that the total of the taxes differs by a penny from the total property tax. If you add together the taxes, the total is 1253.33; however, the total property tax appears as \$1,253.34. The â€œpenny offâ€ problem occurs because the ToString method rounds the various taxes before they are displayed. However, the tax amounts are not rounded when they are used to calculate the total tax. Stop the application.

g. You can fix the â€œpenny offâ€ problem using the Math.Round method. The methodâ€™s syntax is Math.Round(number, decimalPlaces). In the syntax, number is the number to be rounded, and decimalPlaces indicates the number of decimal places to include in the rounding. For example, Math.Round(4.658, 2) evaluates to 4.66. Use the Math.Round method to fix the â€œpenny offâ€ problem.

h. Save the solution and then start the application. Test the application using 121920 as the assessed value. This time, the total property tax appears as \$1,253.33. Close the Code Editor window and then close the solution.