Question: using System; using static System.Console; class InputMethodDemo Notice the { keyword out. static void Main() int first, second; Input Method (out first, out second); WriteLine(After

 using System; using static System.Console; class InputMethodDemo Notice the { keyword
out. static void Main() int first, second; Input Method (out first, out

using System; using static System.Console; class InputMethodDemo Notice the { keyword out. static void Main() int first, second; Input Method (out first, out second); WriteLine("After Input Method first is {0}", first); WriteLine("and second is {0}", second); } private static void InputMethod(out int one, out int two) { string si, s2; Write("Enter first integer "); Notice the sl = ReadLine(); Write("Enter second integer "); keyword out. s2 = ReadLine(); one = Convert.ToInt32(51); two = Convert.ToInt32(s2); } } Figure 8-5 The InputMethodDemo program Instructions Write a program named InputMethodDemo2 that eliminates the repetitive code in the InputMethod() in the InputMethodDemo program in Figure 8-5. 8 9 Rewrite the progtam so the InputMethod() contains only two statements: Input MethodDemo2.cs + 1 using static System.Console; 2 using System; 3. class InputMethodDemo 2 4 { 5 static void Main() 6 { 7 int first, second; InputMethod(out first, out second); WriteLine("After InputMethod first is {0}", first); 1e WriteLine("and second is {e}", second); 11 } 12 private static void InputMethod(out int one, out int two) 13 { 14 string si, s2; 15 Write("Enter first integer"); 16 s1 = ReadLine(); 17 Write("Enter second integer "); 18 s2 = ReadLine(); one = DataEntry("first"); two = DataEntry("second"); (Note: The program in Figure ir provided as starter - >

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!