Question: C# Programing Code Lab 8-7 m Instructions InputMethodDemo2.cs + Write a program named Input MethodDemo2 that eliminates the repetitive code in the InputMethod) in the
C# Programing

Code Lab 8-7 m Instructions InputMethodDemo2.cs + Write a program named Input MethodDemo2 that eliminates the repetitive code in the InputMethod) in the InputMethodDemo program in Figure 8-5. Rewrite the program so the Input Method contains only two statements: one = Data Entry("first"); two = Data Entry("second"); 1 using static System.Console; 2 using System; 3 class InputMethodDemo2 4 { 5 static void Main() 6 { int first, second; 8 InputMethod (out first, out second); 9 WriteLine("After InputMethod first is {0}", first); 10 WriteLine("and second is {0}", second); 11 } 12 private static void InputMethod (out int one, out int two) 13 { 14 string s1, s2; 15 Write("Enter first integer "); 16 s1 = ReadLine(); 17 Write("Enter second integer "); 18 52 = ReadLine(); 19 one = Convert.ToInt32 (51); 20 two = Convert.ToInt32 (52); 21 } 22 23 public static int DataEntry(string whichone) 24 { 25 } 26 27 } 28 (Note: The program in Figure 8-5 is provided as starter code.) Figure 8-5: using System; using static System.Console; class Input MethodDemo 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 Input Method(out int one, out int two) string si, 52; Write("Enter first integer "); s1 - Readline 0; Notice the keyword out. Write("Enter second integer"); s2 = ReadLine: one - Convert.ToInt32 (51); two - Convert.ToInt32 (s2); } Figure 8-5 The InputMethodDemo program Grading @ When you have completed your program, click the Submit button to record your score
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
