Question: Using Visual Programming C# coding QUESTION 1 a) Write the code to choose an integer random number that ranges from 1 to 20 (both inclusive).
Using Visual Programming C# coding



QUESTION 1 a) Write the code to choose an integer random number that ranges from 1 to 20 (both inclusive). Place the generated integer random number into an identifier called myRandintNo. (3 marks) b) You have a form that has two textboxes which you will key in numbers. It has button to submit the input, which you will run a process. When you submit the input, you will process to find the sum of the two numbers. Place the output in a MessageBox by having this message of this kind: The sum of 1 and 2 is 3. The output is an odd number. Check for FormatException data validation (7 marks) QUESTION 2 a) What does this code in Figure 1 do? private void button1_Click(object sender, EventArgs e) foreach (Control c in Controls) { if(c is Label) { if(c. Tag == "Yes": c.Text = string. Empty; } } Figure 1 (1 mark) b) Based from the code snippet in Figure 2. answer the following questions. int b = 0; foreach(int a in thisVariable.Items) { b += a; } Figure 2 i. What structure could this Variable be? (1 mark) ii. What datatype does the items in this Variable hold? 111. Change the foreach loop into do-while loop. (7 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
