Example #1
0
        static void Main(string[] args)
        {
            Prefecture prefecture = InputPrefecture();

            if (prefecture == null)
            {
                return;
            }

            Age age = InputAge();

            if (age == null)
            {
                return;
            }

            if (prefecture.Value == Prefecture.Tochigi && age.Value >= 18)
            {
                UserInterface.OutputString("割引料金です");
            }
            else
            {
                UserInterface.OutputString("通常料金です");
            }
        }
Example #2
0
        static Prefecture InputPrefecture()
        {
            string choices = GetPrefectureChoices();
            string message = "次の地域を入力してください [" + choices + "]";
            string s       = UserInterface.InputString(message);

            Prefecture r = new Prefecture(s);

            if (r.IsValid)
            {
                return(r);
            }
            UserInterface.OutputString("地域の入力が間違っています");
            return(null);
        }
Example #3
0
        static string GetPrefectureChoices()
        {
            string        r    = "";
            List <string> list = Prefecture.GetList();

            foreach (var x in list)
            {
                if (r != "")
                {
                    r += "/";
                }
                r += x;
            }

            return(r);
        }