please help me Java I need to Complet the code for the metho
please help me Java
I need to Complet the code for the method.
my code link: https://codeshare.io/f2LIz
Solution
Hi,
I have implemented the required methd and highlighted the code changes
public static void printReceipt(ArrayList<String> menuItems, double[] prices)
{
String numSTR, lines;
double total = 0;
NumberFormat fmt=NumberFormat.getCurrencyInstance();
lines= \" Your Receipt\ \";//4 spaces
lines+= \"Item Price\ \";//13 spaces
for(int i =0; i<menuItems.size();i++)
{
numSTR = menuItems.get(i);
lines += numSTR+\"\\t\\t\"+fmt.format(prices[i])+\"\ \";
total += prices[i];
}
lines +=\"----------------------\ \";
lines += \"Total\\t\\t\"+fmt.format(total)+\"\ \";
/*I need code*/;//creat total line
//Complete the code to display lines in the JOptionPane
/*I need code*/
JOptionPane.showMessageDialog(null, lines);
}//end of method
