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/D1Pew

Solution

Hi,

I have implemented the below method and highlighted the code changes below.

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

please help me Java I need to Complet the code for the method. my code link: https://codeshare.io/D1PewSolutionHi, I have implemented the below method and highl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site