当前位置: 首页>>代码示例>>C#>>正文


C# Student.YearsRemaining方法代码示例

本文整理汇总了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.
        */
    }
开发者ID:George-Lee,项目名称:uniwork,代码行数:46,代码来源:Student.cs


注:本文中的Student.YearsRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。