Help with methods, beginner

I am working on a basic loan calculator program. I need to make three methods that feed into a main method with contents of variables and call of methods
GetLoanTerms( );

CalculatePayment( );

DisplayResults( );

How do i set the variables in the first method and make them public to be used in the rest of the program. What I have now is below but I am getting an error calling the variables. How do i ref the variables for the get method into the main method?

static void Main(string[] args) {

 GetLoanTerms( , , ); CalculatePayment(); DisplayResults(); } public double GetLoanTerms (ref double LoanAmt, ref double Interest, double Periods) { Console.WriteLine("Please enter your loan amount."); return LoanAmt = double.Parse(Console.ReadLine ()); Console.WriteLine("Now enter your interest rate."); return Interest = double.Parse(Console.ReadLine()); Console.WriteLine("How many months will you pay the loan over?"); return Periods = double.Parse(Console.ReadLine()); Console.WriteLine("Your inputs are " + LoanAmt + Interest + Periods); } 

by Ifanyonecan via /r/csharp

Leave a Reply