Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

107 MA ammeter 56 resistor ? V voltmeter

Answered: 1 week ago

Question

Generally If Drug A is an inducer of Drug B , Drug B levels will

Answered: 1 week ago