Ok this is a homework program and this is my first JAVA course

I am stuck on how to pass double values from one method to another
I have a menu that appears with this code

public static int menu(int curmenuselection, double curitemprice)
  {
   while(curmenuselection !=  5)
   {
   double subtotal = 0;
    double tax = 0;
    double total = 0;
    DecimalFormat df = new DecimalFormat("0.00");
    String entry;
     entry = JOptionPane.showInputDialog(null,
         "Item            " + df.format(curitemprice) + "\n" +
         "Subtotal     " + df.format(subtotal(finalprc)) + "\n" +
         "Tax             " + df.format(tax) + "\n" +
         "Total           " + df.format(total) + "\n" +
         "****************************************\n" +
         "1 - Enter Item Cost \n" +
         "2 - Clear Last Item \n" +
         "3 - Payment By Customer \n" +
         "4 - Close Out Customer \n" +
         "5 - Quit \n" +
         "Enter the number of your choice:", "Menu",
             JOptionPane.QUESTION_MESSAGE);
          curmenuselection = Integer.parseInt(entry);
          switch (curmenuselection)
          {
            case 1: itemcost(curitemprice);
              continue;
            case 2: dbg(curitemprice, finalprc);
              continue;
            case 3:
              continue;
            case 4:
              continue;
            case 5: System.exit(0);
              break;

          }
   }

And need the Item part of the menu "df.format(curitemprice)" to update what the user enters. The user enters it in this method

public static void itemcost(double curitemprice)
  {
    String entry;
             entry = JOptionPane.showInputDialog(null,
             "Enter Item Cost (Max of 4999.99)",
             "Item Cost",
             JOptionPane.QUESTION_MESSAGE);
       curitemprice = Double.parseDouble(entry);
  }

I am trying to pass the curitemprice to the method menu(int curmenuselection, double curitemprice) above but it will not display when the menu method refreshes.

Any ideas or pointers would help. Thanks

Why does int menu return an int, but you aren't returning anything?
The itemCost method is the one that should be returning something, in my opinion.

Why does int menu return an int, but you aren't returning anything?
The itemCost method is the one that should be returning something, in my opinion.

Thanks anyway I figured it out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.