Question: Write a programming code for c#: This is the first in a series of assignment that will read data from a text file and perform

Write a programming code for c#:

This is the first in a series of assignment that will read data from a text file and perform actions on the data.

We'll be reading from a file containing some of the following politician information:

Clinton, Hillary F Democrat

Sanders, Bernie M Democrat

Cruz, Ted M Republican

...

For each line in the file note that we have last name, first name, gender (M/F), and party affiliation.

The goal of this assignment is to build a "salutation" for each politician as follows:

Dear Ms. Hillary Clinton:

~or~

Dear Mr. Ted Cruz:

So, you will need to: a) "flip" the last and first names, and b) use gender to determine whether to use "Ms." or "Mr.".

Print the salutation to the console.

For extra credit, sort the list by political party.

in the file it contains this code:

namespace ConsoleReadInvitations

{

class Program

{

static void Main(string[] args)

{

const string TEXT_FILE = "Invitations.txt";

var linesRead = File.ReadAllLines(TEXT_FILE);

foreach (string line in linesRead)

{

//format salutation as:

//

// Dear Ms. Hillary Clinton:

// ~or~

// Dear Mr. Ted Cruz:

Console.WriteLine(line);

}

Console.ReadLine();

}

}

}

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!