Hi all,
I was wondering if you could help me with the following problem. I need help adding the prices together, I am confused on what the code is. The following code is correct, just I don't know how to add the prices together. e.g.
2 waters and 1 food equals £3.15
Code:
public void actionPerformed(ActionEvent e) {
DecimalFormat pound= new DecimalFormat("#.##");
select= (String) JOptionPane.showInputDialog
(project.this,"Select",
Select,JOptionPane.INFORMATION_MESSAGE, null, products,
"food");
if (select.equals("food"))
price = 0.65;
else if (select.equals("water"))
listprices = 1.25;
else
price = 0.0;
listmodel.addElement(select+ " £" +pound.format(price));
}
Thanks in advance,
hypon