maybe someone can help with this problem
public void getSecondInput()
{
try
{
priceOfItems = Integer.parseInt(priceOfItemsJTextField.getText()) ;
calculateOutput();
}
catch(NumberFormatException exception)
{
JOptionPane.showMessageDialog(this,
"Please enter Price per Item!",
"Number Format Error", JOptionPane.ERROR_MESSAGE );
priceOfItemsJTextField.setText("");
priceOfItemsJTextField.requestFocusInWindow();
}
}
public void calculateOutput()
{
subTotal = calculateSum(numberOfItems, priceOfItems);
displayOutput();
}
public int calculateSum(int valueOne, int valueTwo)
{
return valueOne * valueTwo;
}
public void displayOutput()
//priceOfItems = Integer.parseInt(priceOfItemsJTextField.getText()) ;
calculateOutput();// I think this might be wrong.
The problem im having is in writing the code for multiplying the numberOfItems which is an integer and the priceOfItems which is a double, i get an error code saying this.
RetailSales.java:250: calculateSum(int,int) in RetailSales cannot be applied to (int,double)
subTotal = calculateSum(numberOfItems, priceOfItems);
I have a feeling my priceOfItems code is wrong because its a double, but the book im using really isnt any help, and ive tried everything i can think of. If i change priceOfItems to an Int up at the declaration section, the program works fine. any ideas?