I need to get the "math" variable into another method. any help would be appreciated.
public static void Amount()
{
Scanner input = new Scanner(System.in);
double initialAmount;
double paycheckAmount;
// user inputs the initial amount that is in their bank account
System.out.println("Please enter your initial amount in you bank account.");
initialAmount = input.nextDouble();
input.nextLine();
// dont let user input a negative value
while(initialAmount < 0)
{
System.out.println("That is an invalid Value, please enter a valid value.");
System.out.println("Please enter your initial amount in you bank account.");
initialAmount = input.nextDouble();
input.nextLine();
}
// user inputs the amount of their paycheck, that amount gets added to the initial amount
System.out.println("Please enter your paycheck amount.");
paycheckAmount = input.nextDouble();
input.nextLine();
// dont let the user input a negative value
while(paycheckAmount < 0)
{
System.out.println("That is an invalid Value, please enter a valid value.");
System.out.println("Please enter your paycheck amount.");
paycheckAmount = input.nextDouble();
input.nextLine();
}
double math = initialAmount + paycheckAmount;
System.out.println("You have " + math + " dollars in your bank account");
} // end of amount method