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;
}
}

