Introduction to Programming in C# – Exercise 2

In this exercise, you will create a new C# solution and project in Visual Studio.

The program in your project uses read/write to file functions in the .NET framework to read and modify this text:

english teachers detest me
because i never capitalize my i’s
but they never once bothered
to come and ask me why.

uppercase is a privilege
at least, it is in my mind.
it’s reserved for war heroes
or a painter who is blind.

i have done nothing remarkable.
i have hardly even tried
everything good i’ve done
is eventually cast aside.

why do i deserve an uppercase?
or for that matter, why do you?
we’ve done plenty of bad
when there’s plenty of good to do.

english teachers detest me
because i never capitalize my i’s
but i will have reason to someday
and i hope that is not a lie.

Your program should do the following (see code below):

  1. Read the text from a local file into memory. Use the File.ReadLines method.
  2. Change the first character of each sentence from lower case to upper case. Use String methods.
  3. Print modified sentences to the console.
  4. Save the modified text to a local file.

You can reuse this program outline:

Steps to complete the exercise:

  1. Create a new solution and project in VisualStudio.
  2. Write your program.
  3. Submit:
    1. Create a .zip file of your solution.
    2. Submit the .zip file on TUWEL until Tuesday, October 31, 5pm.

Grading criteria:

  • Correctness of the modified text file.
  • Tidy code formatting (this is similar to a professionally drawn floor plan):
    • Use indentation (see code examples).
    • Consistent formatting.
    • Add comments where necessary. This helps you and others understand your code.