Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# only please You will find a file named USPopulation.txt info below. The file

ID: 3685203 • Letter: C

Question

C# only please

You will find a file named USPopulation.txt info below. The file contains the midyear population of the United States, in thousands, during the years 1950 through 1990. The first line in the file contains the population for 1950, the second line contains the population for 1951, and so forth.

Create an application that reads the file's contents into an array or a List. The application should display the following data:

The average annual change in population during the time period

The year with the greatest increase in population during the time period

The year with the least increase in population during the time period

Explanation / Answer

class Program { const int SIZE = 50; static void Main() { // This line of code gets the path to the My Documents Folder int zero = 0; int counter = 0; int n, m; StreamReader myFile; myFile = new StreamReader("C:/grades.txt"); string inputNum = myFile.ReadLine(); do { Console.Write("The test scores are listed as follows:"); string[] splitNum = myFile.Split(); n = int.Parse(splitNum[0]); { if (n != zero) { Console.Write("{0}", n); counter++; } } } while (counter