Question: Fix four flaws in the following program. // Fix four flaws // Note: there are more than four flaws! static void Main(string[] args) { string

Fix four flaws in the following program.

// Fix four flaws // Note: there are more than four flaws!

static void Main(string[] args) { string userName = Console.ReadLine(); DoLotsOfstuff(userName); }

static void DoLotsOfstuff(string n) { bool guest; int i;

if (n = "Student") { Console.WriteLine("Welcome " + n); guest = false; } else if (n = "Admin") { Console.WriteLine("Welcome " + n); guest = false; } else { Console.WriteLine("Welcome " + n); guest = true; }

for (i = 0; i < len(n); i++) Console.Write(n[i]); Console.WriteLine(); }

You will need to retype this program into C#, and then make changes. For ease of grading, please mark your changes with comments, such as:

// Change 2: Changed the variable name from n

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!