Write a program to calculate the property tax



After answering this question you will be able to:

b) Distinguish between instance variables and class variables

c) Distinguish between methods and class methods

d) Know how to call class methods and how to call instance methods

e) Format numbers to reflect dollar currency

Write a program to calculate the property tax. Property tax is calculated on 92% of the assessed value of the property. For example, if the assessed value is $100,000.00, the property tax is on $92,000.00. Assume that the property tax rate is $1.05 for each $100.00 of the assessed value. Your program should produce an output similar to the following.

The following test class generates the following output. Write the class PropertyTax.

import java.text.NumberFormat;

class TestPropertytax

{

public static void main(String[] arg)

{

NumberFormat nf = NumberFormat.getCurrencyInstance();

PropertyTax p1 = new PropertyTax(100000, 1.05);

p1.calculate();

print(p1, nf);

System.out.println("----------------------------------");

PropertyTax p2 = new PropertyTax(150000, 1.05);

p2.calculate();

print(p2, nf);

System.out.println("----------------------------------");

System.out.println("Total tax revenue " + nf.format(PropertyTax.totalTax()));

System.out.println("--------- End of report ----------");

}

static void print(PropertyTax p, NumberFormat nf)

{

System.out.println("Assessed value " + nf.format(p.getAssessedValue()));

System.out.println("Taxable amount " + nf.format(p.getTaxableAmount()));

System.out.println("Tax rate for each $100.00 is " + nf.format(p.getTaxRate()));

System.out.println("Property tax is " + nf.format(p.getTax()));

}

}

[pic]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download