Create a new project, and copy your code from Task 1 to the new project (copy the contents of the Main() method and the displayDetails() method) Adapt your Main() method to capture and display the details for 4 different people. The displayDetails() method should remain unchanged.
internal class Program
{
static void Main()
{
Console.WriteLine("Hello world");
for (int i = 0; i < 4; i++)
{
Console.WriteLine($"Enter data for {i+1} person");
Console.Write("Enter nickname: ");
string nickname = Console.ReadLine();
Console.Write("Enter favourite movie/series: ");
string favouriteMovie = Console.ReadLine();
displayDetails(nickname, favouriteMovie);
Console.WriteLine();
}
Console.ReadKey();
}
static void displayDetails(string nickname, string favouriteMovie)
{
Console.WriteLine($"Your nickname {nickname}, and favorite series/movie: {favouriteMovie}");
}
}
Comments
Leave a comment