本文整理汇总了C#中Student.YearsRemaining方法的典型用法代码示例。如果您正苦于以下问题:C# Student.YearsRemaining方法的具体用法?C# Student.YearsRemaining怎么用?C# Student.YearsRemaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student.YearsRemaining方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Student queries = new Student();
//First, let's just say hello.
Console.WriteLine("Welcome to the \nUniversity of Derby's \nStudent Enquiry System");
//Now let's grab their name
Console.Write("Please enter the name of the student: ");
string studentName = Console.ReadLine();
//Their student number
Console.Write("Please enter their student number: ");
int studentNumber = int.Parse(Console.ReadLine());
//Their age
Console.Write("Please enter student's age: ");
int age = int.Parse(Console.ReadLine());
//Their hometown
Console.Write("Please enter town of residence: ");
string town = Console.ReadLine();
//Course information (Length of study and current year)
Console.Write("Please enter current year of study: ");
int currentYear = int.Parse(Console.ReadLine());
//Now we display the student summary screen.
Console.WriteLine("***************************************");
Console.WriteLine("* Summary for "+studentName+": "+studentNumber);
Console.WriteLine("***************************************");
Console.WriteLine("Age: "+age);
if(queries.IsMature(age)==true)
{
Console.WriteLine("This student is considered a mature student.");
}
Console.WriteLine("From: "+town);
queries.HomeTown(town);
Console.WriteLine("The student has " + queries.YearsRemaining(currentYear) + " year(s) remaining in their course");
/* Next we want to see code for the following:
1) Calling a method that calculates the number of years study remaining.
2) Call a method that tells us whether the student is not from Derby. This will then display an outcome regards student accomodation.
3) Is a mature student.
*/
}