My code has a method where the users input a bunch of variables and then those variables get added together in a new variable. What I want to know is how do I call the variable that is in the other method to another method?
import java.util.*; public class Calc{ public static void main (String [] args){ determinevalue1(); determinevalue2(); determineTotalvalue(double value1, double value2); } public static double determinevalue1(){ Scanner console = new Scanner(System.in); System.out.println("Enter your first number"); double v1 = console.nextDouble(); System.out.println("Enter your next number"); double v2 = console.nextDouble(); double vtotal = 365 * (v1 / v2); value1 = 2.3 * vtotal; return value1; } public static double determinevalue2(){ Scanner console = new Scanner(System.in); System.out.println("Enter your first number"); double v1 = console.nextDouble(); System.out.println("Enter your next number"); double v2 = console.nextDouble(); double vtotal = 365 * (v1 / v2); value2 = 2.3 * vtotal; return value1; } public static double determineTotalvalue(){ double totalvalue = (value1 + value2) / 1000; System.out.println(totalvalue); return totalvalue; } }