I need help with a programming assignment

Nov 27th, 2015
Price: $15 USD

Question description

  1. Paste the following code into the main() method.  Modify the code; so that it works (You’ll have to make 2 small modifications).  It should output the value of each string in the array called names.

string[] names = { "Al Dente", "Anna Graham", "Earle Bird", "Ginger Rayle", "Iona Ford" };

int i = 0;

while (i < names.Length)




2. Modify the code from problem 1, so that it outputs a number and then a person’s name using the following output statement.

Console.WriteLine("{0,2}. {1}", i, names[i]);

3. Modify the code from problem 6, so that it uses a foreach loop as opposed to a while loop.  The output should appear exactly the same as it did after step 2.

Tutor Answer

(Top Tutor) Daniel C.
School: UIUC

Studypool has helped 1,244,100 students

Review from our student for this Answer

Nov 27th, 2015
"This tutor is great!"
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1822 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors