Class declaration with a public method that has a parameter.
using System;
public class MyClass
{
public void DisplayMessage( string courseName )
{
Console.WriteLine( "Welcome to the grade book for\n{0}!",courseName );
}
}
public class MyClassTest
{
public static void Main( string[] args )
{
MyClass myMyClass = new MyClass();
Console.WriteLine( "Please enter the course name:" );
string nameOfCourse = Console.ReadLine();
Console.WriteLine();
myMyClass.DisplayMessage( nameOfCourse );
}
}
Related examples in the same category