Question: Find and fix the bugs in a c# program /* This program computes the average of a student's grades. The expected output is: The program
Find and fix the bugs in a c# program
/* This program computes the average of a student's grades. The expected output is:The program has a syntax error (wrongly coded), a specification error (wrongly implemented), and a semantic error (wrong logic). Discuss with the instructor what each of the errors is and why they are wrong. After a response, fix the specification and semantic errors and test to ensure that the program is working as expected. */ using System; using System.IO; namespace IDL5 { public class dumper { public static void Main(string[] args) { string lines; var fileStream = new FileStream(@"c:\windows\win.ini", FileMode.Open, FileAccess.Read); using (var streamReader = new StreamReader(fileStream)) { string text = streamReader.ReadToEnd(); lines = text.Split(' '); } int num = 0; foreach (string line in lines) { Console.WriteLine(num + 1 + ": " + lines[num]); } } } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
