|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help me! new to programming and can't figure this out!
For one of my assignments we have to create a class to determine the Total Tax Revenue one two houses. I have created the class and the Test class as well but I cannot seem to get the total tax revenue from the two houses.
I will put the class and test class as well. I will put the ? mark where I do not know what to do in. Also the testclass was given, we were just assigned to make up the class so i can't make any changes to the testclass. please help i kno this is probably an easy solution for experienced programmers, but for someone who just started a week ago, its hard! public class PropertyTax { private double assessedvalue; private double taxrate; private static double taxableamount; private static double propertytax; private static double totaltaxrevenue; public PropertyTax(double AssessedValue, double TaxRate) { assessedvalue = AssessedValue; taxrate = TaxRate; taxableamount = assessedvalue*.92; propertytax = taxableamount*(taxrate/100); totaltaxrevenue = ??????????; } public double getAssessedValue() { return assessedvalue; } public double getTaxRate() { return taxrate; } public double getTax() { return propertytax; } public double getTaxableAmount() { return taxableamount; } public static double totalTax() { return totaltaxrevenue = ??????; } public double calculate() { return propertytax = taxableamount*(taxrate/100); } } 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())); } } |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Help me! new to programming and can't figure this out! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|