Question: In this C# program, I need to show the information provided by the user. I have attached the code but I need help generating the
In this C# program, I need to show the information provided by the user. I have attached the code but I need help generating the output. The output should look like this:
OUTPUT________________________________________________________________________
(Note: The following information is provided by the user.)
Enter first name: michael
Enter last name: johnson
Enter street: 999 first street
Enter city: seattle
Enter state: washington
Enter zip code: 98433
(The following information is generated automatically. There are upper case letters at the beginning of every word.)
Costumers information:
Michael
Johnson
999 First Street
Seattle
Washington
98433
Press any key to continue...
Here is the code I have: public class LINQWithListCollection
{
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);
}
public static void Main(string[] args)
{
List
Console.Write("Enter first name: ");
String input = Console.ReadLine();
items.Add(input);
Console.Write("Enter last name: ");
input = Console.ReadLine();
items.Add(input);
Console.Write("Enter street: ");
input = Console.ReadLine();
items.Add(input);
Console.Write("Enter city: ");
input = Console.ReadLine();
items.Add(input);
Console.Write("WriteEnter state: " );
input = Console.ReadLine();
items.Add(input);
Console.Write("Enter Zip code: ");
input = Console.ReadLine();
items.Add(input);
var allCapital =
from item in items
let uppercaseString = UppercaseWords(item)
select uppercaseString;
foreach (var item in allCapital)
{
Console.WriteLine("{0} ", item);
}
Console.WriteLine("Press any key to continue...");
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
