public string Name { get; set; }
public int Age { get; set; }
Console.WriteLine("Invalid GPA value, should not be negative");
public Student(string name, int age, double gpa)
public double GetGPA(string strType)
if (strType == "adjusted")
return (val > 4) ? 4 : val;
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 student1 = new Student(strName, iAge, dGPA);
Console.WriteLine(student1.GetGPA("regular"));
Console.WriteLine(student1.GetGPA("adjusted"));
Console.WriteLine(student1.LuckyDraw());
Console.WriteLine("=================");
Console.WriteLine("Age:{0}, GPA:{1}", iAge, dGPA);
Function(iAge, ref dGPA);
Console.WriteLine("Age:{0}, GPA:{1}", iAge, dGPA);