Write a user defined method named displayDetails() that declared and assigns values to local variables for your nick name, your student number, and your favourite movie. The method should also contain 3 WriteLine statements to display your nick name, your student number, and your favourite movie. Write a program that displays the text Hello World and then calls the displayDetails() method to display your information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Data;
using System.Data.SqlClient;
namespace Q201123
{
class Program
{
/// <summary>
/// Main method
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
//Write a program that displays the text Hello World and then calls the displayDetails() method to display your information.
Console.WriteLine("Hello World");
displayDetails();
Console.ReadLine();
}
/// <summary>
/// method named displayDetails() that declared and assigns values to local variables for your nick name, your student number,
/// and your favourite movie. The method should also contain 3 WriteLine statements to
/// display your nick name, your student number, and your favourite movie.
/// </summary>
static void displayDetails()
{
string nickName = "My Nick Name";
string studentNumber = "My Student number";
string favouriteMovie = "My Favourite movie";
Console.WriteLine(nickName);
Console.WriteLine(studentNumber);
Console.WriteLine(favouriteMovie);
}
}
}
Comments
Leave a comment