I need help with a programming assignment

Nov 27th, 2015
SKTFaker
Category:
Programming
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)

{

  Console.WriteLine(names[0]);

}

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.
(997)
School: UIUC
PREMIUM TUTOR

Studypool has helped 1,244,100 students

7 Reviews


Summary
Quality
Communication
On Time
Value
kpcutie
Nov 28th, 2016
" Excellent job "
Hemapathy
Nov 15th, 2016
" all I can say is wow very fast work, great work thanks "
BlueOcean
Nov 1st, 2016
" Awesome! Exactly what I wanted. "
kevin12622
Oct 23rd, 2016
" Goes above and beyond expectations ! "
ashleyisgod
Oct 10th, 2016
" Top quality work from this guy! I'll be back! "
likeplum4
Oct 1st, 2016
" Excellent work as usual "
Molly_Moon
Sep 17th, 2016
" AMAZING as always! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 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