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

import java.text.NumberFormat;
import java.util.*;

import javax.swing.JOptionPane;


public class printReceiptClass {

   /**
   * @param args
   */
   /*
   Here is question
   Complete the code for the method printReceipt below. It accepts an ArrayList of string objects and array of doubles as its two arguments. It will produce a receipt for the items purchased displayed in a JOptionPane with a Monospaced Font.
   the item names are in the ArratList. The price of each item is in the array. Assume the longest name is 10 charaters and the prices are all <=9.99 Note: each line pis 22 spaced wide.
   */

   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<prices.length;i++)
       {
          
           numSTR = fmt.format(prices[i]);
          
           lines += menuItems.get(i)+\" \"+numSTR+\"\ \";
          
           total += prices[i];
       }
       lines +=\"----------------------\ \";
       lines += \"Total \"+fmt.format(total)+\"\ \";
               /*I need code*/;//create total line
       //Complete the code to display lines in the JOptionPane
       /*I need code*/
       JOptionPane.showMessageDialog (null,lines, \"Message\", JOptionPane.INFORMATION_MESSAGE);
   }//end of method
   public static void main(String[] args) {
       // TODO Auto-generated method stub
       //JOptionPane.showMessageDialog (null, \"Message\", \"Title\", JOptionPane.INFORMATION_MESSAGE);
       ArrayList<String> x = new ArrayList(Arrays.asList(\"Apple\", \"Carrot\"));
double[] p = {1.23,2.45};
printReceipt(x, p);
   }

}

please help me Java I need to Complet the code for the method. my code link: https://codeshare.io/f2LIzSolutionimport java.text.NumberFormat; import java.util.*
please help me Java I need to Complet the code for the method. my code link: https://codeshare.io/f2LIzSolutionimport java.text.NumberFormat; import java.util.*

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site