title: Absolute java beginner. I cannot use a returned variable
body: <p>This assignment is to calculate the cost of a hospital visit. I am trying to ask the user what the prices for the "overnightCharge", "medicationCharge", and "labCharge" are. I then try to use the input to add them together in the method called "total". Next, I try to print the resulting/returned variable from "total" method in the main method by typing <code>System.out.println("Your total charge is:   " + total(totalCost)</code>. I thought <code>total(totalCost)</code> would retrieve the variable returned by "total" method. </p>
  
  <pre><code>package hospitalstay;
  import java.util.Scanner;
  /* total charges
  if overnight charges
  medication charges
  lab charges
  ask user if new patient*/
  
  public class HospitalStay {
  
  
  public static void main(String[] args) {
      System.out.println("Your total charge is:   " + total(totalCost); // i want to print the "totalCost variable" returned by the "total" method.
  
  
  }
  
  public static double overnightCharge () {// asking user for overnight charge
      Scanner sc = new Scanner (System.in);
      System.out.println("What is your overnight charge");
      double overnightCharge;
      overnightCharge = sc.nextDouble();
      return overnightCharge;
  }
  
  public static double medicationCharge() {// asking user for medication charge
      Scanner sc = new Scanner (System.in);
      System.out.println("What is your medication charge");
      double medicationCharge;
      medicationCharge = sc.nextDouble();
      return medicationCharge;
  }
  
  public static double labCharge() {//asking user for lab charge
      Scanner sc = new Scanner (System.in);
      System.out.println("What is your lab charge");
      double labCharge;
      labCharge = sc.nextDouble();
      return labCharge;
  }
  public static double total (double medicineCharge, double labCharge, double overnightCharge) {
      double totalCost;
      if (overnightCharge == 0) {
          totalCost = (overnightCharge + medicineCharge + labCharge); //Calculating all three charges
      }
      else {
          totalCost = (medicineCharge + labCharge);
      }
      return totalCost;
  }
  }
  </code></pre>