Question: 1. Create a string List. 2. Use Console.ReadLine() to collect values of firstName, lastName, street, city, state, zip, save them to List. 3. Write a

1. Create a string List.

2. Use Console.ReadLine() to collect values of firstName, lastName, street, city, state, zip, save them to List.

3. Write a simple Linq statement, call method UppercaseWords() to change first letter to uppercase.

4. Create a foreach statment to display the information.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public static string UppercaseWords(string value) { char[] array = value.ToCharArray(); if (array.Length >= 1) { if (char.IsLower(array[0])) { array[0] = char.ToUpper(array[0]); } } for (int i = 1; i < array.Length; i++) { if (array[i - 1] == ' ') { if (char.IsLower(array[i])) { array[i] = char.ToUpper(array[i]); } } } return new string(array); }

I have the correct code, but for some reason the input data is not displaying after it is run.

Here is my code:

using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions;

public class Program { public static void Main(string[] args) { List items = new List(); Console.WriteLine("Enter first name: "); string Fname = Console.ReadLine(); items.Add(Fname); Console.WriteLine("Enter last name: "); string Lname = Console.ReadLine(); items.Add(Lname); Console.WriteLine("Enter street: "); string Street = Console.ReadLine(); items.Add(Street); Console.WriteLine("Enter City: "); string city = Console.ReadLine(); items.Add(city); Console.WriteLine("Enter state: "); string State = Console.ReadLine(); items.Add(State); Console.WriteLine("Enter Sip code: "); string Sip = Console.ReadLine(); items.Add(Sip);

foreach (var item in items) { Console.WriteLine(UpperCaseMethod(item.ToLower())); }

} public static string UpperCaseMethod(string input) { if (String.IsNullOrEmpty(input)) throw new ArgumentException("ARGH!"); return input.First().ToString().ToUpper() + input.Substring(1); }

}

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!