Hi can anyone please help me with my homework assignment? I am not asking anyone to do this for me but I keep getting an error in declaring GetInput() inside Main. It says Error: No overload for method GetInput() takes 0 arguments and I can not figure out what I am doing wrong. Any help would be appreciated thanks!

namespace wk1_ilab
{
    class Program
    {
        
        public static void Main(string[] args)
        {
            DisplayApplicationInformation();
            GetInput();
        }
       public static void DisplayApplicationInformation()
        {
            Console.WriteLine("Welcome to the basic user interface");
            Console.WriteLine("CIS247 Week1 iLab");
            Console.WriteLine("This program accepts user input as a string, then makes the appropriate data conversion");

        }
        
        public static void GetInput(string userName)
        {
            userName = Convert.ToString(Console.Read());
            Console.WriteLine(userName);
        }
        public static void GetInput(int userAge)
        {
            userAge = Convert.ToInt32(Console.Read());
            Console.WriteLine(userAge);
        }
        public static void GetInput(double gas)
        {
            gas = Convert.ToDouble(Console.Read());
            Console.WriteLine(gas);
        }
            
        public void TerminateProgram()
        {
            Console.WriteLine("Thanks for using this program, it will now terminate!");
        }

    }
}

In your method GetInput you have a parameter, which you do NOT pass it. Do it this way:

public static void Main(string[] args)
        {
            DisplayApplicationInformation();
            string someName = "this is some name";
            GetInput(someName); //here you have to put a parameter to pass with a method
        }
        
        public static void GetInput(string userName) //because here you have declared a parameter
        {
            userName = Convert.ToString(Console.Read());
            Console.WriteLine(userName);
        }

Or remove parameters on boths sides, or you have to have them on both sides.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.