示例#1
0
        static void Main(string[] args)
        {
            PresFactors p = new PresFactors();
            if (args.Length == 0)
            {
                {
                    



                }
             else{

                 }
                
            }
示例#2
0
        static void Main(string[] args)
        {
            PresFactors p = new PresFactors();

            if (args.Length == 0)
            {
                Console.WriteLine("Are you a natural born citizen?");
                string  yesNo = (Console.ReadLine()).ToLower();
                Boolean noYes;
                if (yesNo.Equals("yes"))
                {
                    noYes = true;
                }
                else
                {
                    noYes = false;
                }
                p.NaturalBornCitizen = noYes;
                Console.WriteLine("How old are You?");
                p.Age = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("How many years have you been living in the US?");
                p.USResidenceYears = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("How many times have you been elected President? Enter 0 if none.");
                p.TimesElected = Convert.ToInt32(Console.ReadLine());
            }
            else
            {
                string  yesNo = (args[0].ToLower());
                Boolean noYes;
                if (yesNo.Equals("yes"))
                {
                    noYes = true;
                }
                else
                {
                    noYes = false;
                }
                p.NaturalBornCitizen = noYes;

                p.Age = Convert.ToInt32(args[1]);
                p.USResidenceYears = Convert.ToInt32(args[2]);
                p.TimesElected     = Convert.ToInt32(args[3]);
            }
            p.EligibilityMessage();
            Console.ReadKey();
        }
示例#3
0
        private void Submit_Click(object sender, EventArgs e)
        {
            PresFactors person = new PresFactors();

            if (citizen.Checked)
            {
                person.NaturalBornCitizen = true;
            }
            else
            {
                person.NaturalBornCitizen = false;
            }
            //get contents of fields and convert to int for all the following

            person.Age = int.Parse(age.Text);
            person.USResidenceYears = int.Parse(yearsResident.Text);
            person.TimesElected     = int.Parse(timesElected.Text);
            //Display result based on input

            presResult.Text = person.ReturnEligibility();
        }