two class help please

alright, the main purpose is to compute how much it will cost if u enter a weight of the bag and the units....i have the math there, but i cant figure out what im doing wrong....any ideas, something isnt right i can see it,

import java.text.DecimalFormat;

import java.util.Scanner;

import javax.swing.*;

public class Coffee {

public static void main(String[] args) {

CoffeeBag checker = new CoffeeBag();

int weight, numUnits;

String numUnits1 = JOptionPane.showInputDialog(null, "Enter the number of bags: ");

String weight1 = JOptionPane.showInputDialog(null, "Enter weight of the units in pounds: ");

weight = Integer.parseInt(weight1);//string to int//

numUnits = Integer.parseInt(numUnits1);

checker.setNumberOfUnits(numUnits);

checker.setUnitWeight(weight);

DecimalFormat df = new DecimalFormat("0.00");

Scanner scanner;

scanner = new Scanner(System.in);

System.out.println("Number of bags sold: " + numUnits);

System.out.println("Weight per bag: " + weight);

System.out.println("Price per pound: $5.99");

System.out.println("Sales tax: 7.25%");

System.out.println();

System.out.println("Total Price: $" + df.format((float)checker.getTotalPrice()));

}

}

class CoffeeBag {

private final static double PRICE_PER_LB = 5.99;

private final static double SALES_TAX= 0.0725;

private int unitWeight, numberOfUnits;

double totalPrice=0;

double subtotal=0;

double salesTax;

double pricePerPound;

//contructors//

public CoffeeBag( int weight, int numUnits ) {

String getWeight;

String getNumUnits;

}

public CoffeeBag() {

}

int weight; int numUnits;

//methods//

public void setUnitWeight( int weight ) {

unitWeight=weight ;

}

public void setNumberOfUnits( int units ) {

numberOfUnits=units;

}

public int getUnitWeight() {

return unitWeight;

}

public int getNumberOfUnits() {

return numberOfUnits;

}

public double getPricePerPound() {

return pricePerPound;

}

public double getSalesTax() {

return salesTax;

}

public double getSubtotal() {

return subtotal;

}

public double getTotalPrice() {

return totalPrice;

}

}

[2407 byte] By [air56a] at [2007-10-2 1:39:40]
# 1

1) You have to tell us exactly what the problem is. People aren't going to guess, or compile and/or run your code to find out.

2) When you post code, please use [code] and [/code] tags as described in [url=http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips[/url] on the message entry page. It makes it much easier to read.

jverda at 2007-7-15 19:03:10 > top of Java-index,Java Essentials,Java Programming...
# 2
I see that Coffee.main is creating a Scanner for apparently no reason at all.
paulcwa at 2007-7-15 19:03:10 > top of Java-index,Java Essentials,Java Programming...