Help us understand the problem. What is going on with this article?

C#でコンソール画面でのカレンダー作ってみた

Test.cs
using System.Collections.Generic;
using static System.Linq.Enumerable;
using static System.Console;
class Sub : object
{
    const int WEEK_MAX = 7;//マジックナンバーは禁止

    public Sub()
    {
    }

    public int Week()
    {
        WriteLine("1/1の曜日を入力");
        switch (ReadLine())
        {
            case "日":
            case "日曜日":
                return 1;
            case "月":
            case "月曜日":
                return 2;
            case "火":
            case "火曜日":
                return 3;
            case "水":
            case "水曜日":
                return 4;
            case "木":
            case "木曜日":
                return 5;
            case "金":
            case "金曜日":
                return 6;
            case "土":
            case "土曜日":
                return 7;
            default:
                return 0;
        }
    }

    public string Calendar(int year,int you)
    {
        if (year <= 0 || you == 0)
        {
            return null;
        }
        WriteLine($"{year}年カレンダー\n");
        var cld = "";
        int max;
        foreach (var y in Range(1, 12))
        {
            cld += $"{y.ToString()}月のカレンダー\n\n"; 
            if (y == 4 || y == 6 || y == 9 || y == 11)
            {
                max = 30;
            }
            else if (y == 2)
            {
                if (year % 4 == 0 && !(year % 100 == 0 && year % 400 != 0))
                {
                    max = 29;
                }
                else
                {
                    max = 28;
                }
            }
            else
            {
                max = 31;
            }
            cld += "日月火水木金土\n";
            foreach (var x in Range(1, max))
            {
                if (x < 10)
                {
                    cld += " ";
                }
                if (x == 1)
                {
                    if (you == 0)
                    {
                        you += 1;
                    }
                    foreach(var z in Range(1, you-1))
                    {
                        cld += "  ";
                    }
                }
                if (you % WEEK_MAX == 0)
                {
                    you %= WEEK_MAX;
                    cld += x.ToString() + "\n";
                }
                else
                {
                    cld += x.ToString();
                }
                you++;
            }
            cld += "\n\n";
        }
        return cld;
    }

    public void End()
    {
        WriteLine("何かを入力してください");
        ReadLine().ToString();
    }

}

class Test
{
    static void Main(string[] args)
    {
        var sub = new Sub();
        Write("調べたい年を入力");
        var year = int.Parse(ReadLine());
        var cld = sub.Calendar(year,sub.Week());
        WriteLine(cld is null? "\n存在しないです\n":cld);
        sub.End();
    }
}
yuri_love
C/C++/C#でゲーム開発,PythonでマルチプラットフォームGUI開発,ラムダ式,ゲームプログラム、その他開発など自分で調べて実証済みのものを発信していきたいと思う。https://twitter.com/reiwawakamono <-是非良ければ、こちらのフォローもよろしくでーす(私もフォローしてまーす)。沢山知識を分かち合って切磋琢磨しようと思ってます。
https://www.youtube.com/channel/UCLGqydKDgOWTu4LMYUgU-pQ?view_as=subscriber
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away