public string Name { get; set; }
public int Age { get; set; }
if (value <0) Console.WriteLine("GPA cannot be set to a negative value ({0})", value);
public Student(string name, int age, double gpa)
public double ShowGPA(string strType)
if (strType == "adjusted") val *= 1.15;
if (val > 4.0) val = 4.0;
return (Name.Length + Age) % 4 == 0;
public static void Function(int i, ref double d)
Console.WriteLine("Entering CallFunction: i = {0}, d = {1}", i, d);
Console.WriteLine("Exiting CallFunction: i = {0}, d = {1}", i, d);
public static void Main()
Student s = new Student(strName, iAge, dGPA);
Console.WriteLine(s.ShowGPA("regular"));
Console.WriteLine(s.ShowGPA("adjusted"));
Console.WriteLine(s.LuckyDraw());
Console.WriteLine("=================");
Console.WriteLine("Age:{0}, GPA:{1}", iAge, dGPA);
Function(iAge, ref dGPA);
Console.WriteLine("Age:{0}, GPA:{1}", iAge, dGPA);