Skip to main content
0 online
theremin thereminOG 2002

After just trying to compile what I coded, I made what I hope are appropiate changes. . and so now my program looks like . .

import java.io.*;
import java.util.*;
import javax.swing.JOptionPane;

public class PropertyTax
{
public static void main(String [] args)
throws FileNotFoundException
{
String inputAssessedValueString;
double inputAssessedValue;
double taxableAmount;
double taxRate_hundreds;
double finalPropertyTax;

inputAssessedValueString = JOptionPane.showInputDialog
("Enter assessed value");

inputAssessedValue = Double.parseDouble(inputAssessedValueString);

taxableAmount = 0.92 * inputAssessedValue;
taxRate_hundreds = taxableAmount / 100;
finalPropertyTax = taxRate_hundreds * 1.05;

JOptionPane.showMessageDialog(null,
String.format("The Assessed Value equals $ %.2f%n",inputAssessedValue)
+ String.format("Taxable Amount equals $ %.2f%n", taxableAmount)
+ String.format("Tax Rate each $ 100.00: $ 1.05")
+ String.format("Property Tax equals %.2f%n", finalPropertyTax),
"Property Tax Calculation",
JOptionPane.INFORMATION_MESSAGE);

PrintWriter outFile = new PrintWriter("a:\\proptax.txt");

outFile.close();
}
}

iwz iwz

looks like you've got something going! i'll have to take a look at this later, as I'm just about leaving work

D
dgiaimoOG 2003

A few things.

1) You haven't actually written anything to your file.

2) You really never want to use doubles or floats for monetary quantities. The rounding errors will kill you. Much better to use a dedicated Currency class that uses fixed point arithmetic, though for this exercise it probably doesn't matter.

3) It's usually good programming practice to give constants names rather than embedding literals, but, again, for this exercise it probably doesn't matter.

Other than that it appears to be good, especially if this is your first time trying to write a Java program.

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.