- Joined
- Feb 25, 2004
- Location
- MA, USA
I want this code
to output a GUI window like this code does
Code:
public void setInvoiceAmount(double Amount)
{
if (getQuantity() < 0)
{
quantity = 0;
}
if (getPricePerItem() < 0)
{
pricePerItem = 0;
}
Amount = (getQuantity() * getPricePerItem());
}
public double getInvoiceAmount()//method to print out InvoiceAmount
{
return Amount;
}
Code:
public void setPricePerItem(int item)//set method for Price Per Item
{
String newItem =
JOptionPane.showInputDialog("What is the price?");
int pricePerItem = Integer.parseInt( newItem);
item = pricePerItem;
}
public double getPricePerItem()//get method for Price Per Item
{
return pricePerItem;
}