Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3276552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:16:14+00:00 2026-05-17T19:16:14+00:00

I’m new to programming and am taking a C# class. I am getting compiler

  • 0

I’m new to programming and am taking a C# class. I am getting compiler error CS1001 when I try to write this program.

I read the Compiler Error description (link below), but I’m really not getting it. What am I doing wrong?

http://msdn.microsoft.com/en-us/library/b839hwk4.aspx

Here is my source code:

using System;
public class InputMethodDemoTwo
{
   public static void Main()
   {
      int first, second;
      InputMethod(out first, out second); 
      Console.WriteLine("After InputMethod first is {0}", first);
      Console.WriteLine("and second is {0}", second);
   }
   public static void InputMethod(out first, out second) 
   // The error is citing the line above this note.
   {
      one = DataEntry("first"); 
      two = DataEntry("second");
   }
      public static void DataEntry(out int one, out int two)
      {
         string s1, s2;
         Console.Write("Enter first integer ");
         s1 = Console.ReadLine();
         Console.Write("Enter second integer ");
         s2 = Console.ReadLine();
         one = Convert.ToInt32(s1);
         two = Convert.ToInt32(s2);
      }
}

According to the instructions, I’m supposed to have a method b (InputData) which pulls statements from method c (DataEntry)… Here are the instructions:

The InputMethod()in the InputMethodDemo program in Figure 6-24 contains repetitive
code that prompts the user and retrieves integer values. Rewrite the program so the
InputMethod()calls another method to do the work. The rewritten InputMethod()
will need to contain only two statements:

one = DataEntry(“first”);

two = DataEntry(“second”);

Save the new program as InputMethodDemo2.cs.”

The InputMethodDemo they are referring to is the same program, except that it calls only one method (the InputMethod) instead of two.

The text I referred to above is “Microsoft® Visual C#® 2008, An Introduction to Object-Oriented Programming, 3e, Joyce Farrell”

Any advice/ help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:16:15+00:00Added an answer on May 17, 2026 at 7:16 pm

    This is what you are expected to do:

    using System;
    
    public class InputMethodDemoTwo
    {
        public static void Main()
        {
    
            int first, second;
    
            InputMethod(out first, out second);
            Console.WriteLine("After InputMethod first is {0}", first);
            Console.WriteLine("and second is {0}", second);
            Console.ReadLine();
        }
    
        public static void InputMethod(out int first, out int second)
        //Data type was missing here
        {
            first = DataEntry("first");
            second = DataEntry("second");
        }
    
        public static int DataEntry(string method)
        //Parameter to DataEntry should be string
        {
            int result = 0;
            if (method.Equals("first"))
            {
                Console.Write("Enter first integer ");
                Int32.TryParse(Console.ReadLine(), out result);
    
            }
            else if (method.Equals("second"))
            {
                Console.Write("Enter second integer ");
                Int32.TryParse(Console.ReadLine(), out result);
            }
            return result;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.