コード例 #1
0
ファイル: Program.cs プロジェクト: Callum-Roberts/HSFC
        static void Main(string[] args)
        {
            Coach myCoach = new Coach();

            for (int i = 0; i < 5; i++)

            {
                Person p1 = new Person();
                Console.WriteLine("Enter Name to add a person : ");
                p1.setName(Console.ReadLine());

                if (myCoach.AddPerson(p1) == true)
                {
                    Console.WriteLine("Person has been added");
                }
                else
                {
                    Console.WriteLine("Coach full");
                    Console.WriteLine(myCoach.getNumOfPassengers());
                }
            }

            Console.WriteLine("Please enter the name you would like to find");
            string passenger = Console.ReadLine();

            Console.WriteLine(passenger + "There seat is " + myCoach.GetSeatByName(passenger));


            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Coach myCoach = newCoach();

            for (int i = 0; i < 5; i++)
            {
                Person p = newPerson();
                Console.WriteLine("Enter Name");
                p.SetName(Console.ReadLine());

                if (myCoach.AddPerson(p) == true)
                {
                    Console.WriteLine("You have a seat");
                }
                else
                {
                    Console.WriteLine("Get out of my coach");
                }
            }
        }