Please check display method, I am trying to call string such as qtyInteger, cand
ID: 3644971 • Letter: P
Question
Please check display method, I am trying to call string such as qtyInteger, candleTypeString, etc from mycandle object, but i am having error. Please help.public void shoppingcard()
{
boolean scentedBoolean = false;
String candleTypeString;
String candleColorString;
int qtyInteger;
try
{
if(scentedCheckBox.isSelected())
scentedBoolean = true;
else
scentedBoolean = false;
candleTypeString = (String) candleTypeComboBox.getSelectedItem();
candleColorString = (String) colorComboBox.getSelectedItem();
qtyInteger = Integer.parseInt(qtyTextField.getText());
Candle myCandle = new Candle(qtyInteger, candleTypeString, candleColorString, scentedBoolean);
}
catch (NumberFormatException err)
{
JOptionPane.showMessageDialog(null,"Enter a valid whole number of boxes. ");
qtyTextField.selectAll();
qtyTextField.requestFocus();
}
}
public void displaySummary()
{
//assigns the entire array to the boxesInteger array
outputTextArea.append("Sale Summary ");
outputTextArea.append("Candle Type" + ' ' + "Color"+' ' + "Quantity" + ' ' + "Scented"+ ' ' + "Total"+
myCandle.candleTypeString +' ' + myCandle.candleColorString + ' ' + myCandle.qtyInteger
+ myCandle.scentedBoolean + ' ');
outputTextArea.append(candleTypeComboBox.getSelectedItem() + "Type " );
Explanation / Answer
this code is ok