title: Resusing method calculation values
body: <p>I am new to methods and am trying to find a way to take the totals from the <code>calculateTotalStay</code> method and <code>calculateMiscCharges</code> method and add them together in the <code>calculateTotalCharges</code> method, I can't figure out how to reuse the values calculated I've tried loads of things including makings a variable = the method name but that caused the first method to display more than once, any help appreciated  </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Wk6Lab1Ex1 {
  
  public static  double standardCharge;
  public static  double miscCharges;
  public static double totalCharges=standardCharge+miscCharges;
  
  public static void main(String[] args) {
      int patientCount = 1;
  
      calculateTotalCharges();
  
  }
  
  
  /**
   * A method to calculate to read in the number of days spent in the clinic and return the figure calculated
   * @return
   */
  public static double calculateStayCharges() {
      String message = "Please enter the number of days you spent in the clinic";
      int daysInClinic=readPositiveInt(message);
  
      double standardCharge=300*daysInClinic;
  
      System.out.println("Your standard charges are" + " " + standardCharge);
      return standardCharge;
  
  
  }
  /**
   * A method to read in and calculate all the miscellaneous charges and total them
   * @return the total for all misc fees
   */
  public static double calculateMiscCharges() {
  
      String message = "Please enter your medication charges";
      double medicationCharges=readPositiveDouble(message);
  
      String message1 = "Please enter your surgical charges";
      double surgicalCharges=readPositiveDouble(message1);
  
      String message2 = "Please enter your physical rehabilitation charges";
      double physicalRehabiliation=readPositiveDouble(message2);
  
      String message3 = "Please enter your lab fees";
      double labFees=readPositiveDouble(message3);
  
      double miscCharges=medicationCharges+surgicalCharges+labFees+physicalRehabiliation;
  
      System.out.println("Your miscellaneous charges are" + " " + miscCharges);
  
  
      return miscCharges;
  
  
  }
  
  /**
   * A method to take the stay charges and misc charges and total them
   * @return the total treatment cost
   */
  public static  double calculateTotalCharges() {
  
      calculateStayCharges();
  
      calculateMiscCharges();
  
  
  
      int standardCharge = 0;
      int miscCharges = 0;
      double totalCharges=standardCharge+miscCharges;
  
      System.out.println("Your total charges are" + " " + totalCharges);
  
      return totalCharges;
  
  
  }
  /**
   * Ensuring the number entered for amount of days is an integer
   * @param prompt the enter number of days prompt
   * @return the int value for number of days
   */
  
  public static int readInt(String prompt)
  {
      // Create a scanner object for input from the console window
      Scanner keyboard = new Scanner(System.in);
  
      // boolean flag which is used to control the
      // data validation loop
  
      boolean numGood = false; // Assume the worst   
      do
      {
          System.out.print(prompt);  // ask for the value
          if(!keyboard.hasNextInt()) // check if what's in the keyboard buffer is not a double
          {
              System.out.println("You must enter an  value!"); // display an error message
              keyboard.nextLine(); // consume the bad value entered
          }
          else
              numGood = true; // value entered is good
      } while(!numGood);
      // at this point we know the value in the
      // keyboard buffer is numeric so we can go ahead and
      // return it.
      return keyboard.nextInt();
  }
  /**
   * The readPositiveInt method reads a positive int value
   * from the console window and will display an appropriate
   * error message if a non-positive int value is entered.
   * @param prompt A prompt to request the user to enter a value
   * @return The positive int value entered.
   */
  public static int readPositiveInt(String prompt)
  {
      int value;
      do
      {
          value = readInt(prompt); // ask for and read an double value
          if (value &lt;0) // check if the value entered is less than 0
              // display an error message
              System.out.println("Error - you must enter a positive numeric value greater than zero!");
      } while (value &lt;0);
      // at this point we know the value entered is positive
      // so return it
      return value;
  }
  /**
   * readDouble ensures the values entered for fees are doubles
   * @param prompt asks user to enter various fees
   * @return returns the double value
   */
  public static double readDouble(String prompt)
  {
      // Create a scanner object for input from the console window
      Scanner keyboard = new Scanner(System.in);
  
      // boolean flag which is used to control the
      // data validation loop
  
      boolean numGood = false; // Assume the worst   
      do
      {
          System.out.print(prompt);  // ask for the value
          if(!keyboard.hasNextDouble()) // check if what's in the keyboard buffer is not a double
          {
              System.out.println("You must enter an  value!"); // display an error message
              keyboard.nextLine(); // consume the bad value entered
          }
          else
              numGood = true; // value entered is good
      } while(!numGood);
      // at this point we know the value in the
      // keyboard buffer is numeric so we can go ahead and
      // return it.
      return keyboard.nextDouble();
  }
  /**
   * The readPositiveDouble method reads a positive double value
   * from the console window and will display an appropriate
   * error message if a non-positive double value is entered.
   * @param prompt A prompt to request the user to enter a value
   * @return The positive double value entered.
   */
  public static double readPositiveDouble(String prompt)
  {
      double value;
      do
      {
          value = readDouble(prompt); // ask for and read an double value
          if (value &lt;0) // check if the value entered is less than 0
              // display an error message
              System.out.println("Error - you must enter a positive numeric value!");
      } while (value &lt;0);
      // at this point we know the value entered is positive
      // so return it
      return value;
  }
  }
  </code></pre>