コード例 #1
0
ファイル: Program.cs プロジェクト: Ham3a/BNU-Comp-Hamza
        /// <summary>
        /// Task 5.6
        /// </summary>
        private static void TestMotelBooking()
        {
            BatesMotel motel = new BatesMotel();

            SimpleIO.WriteTitle("The Bates Motel", "Task 5.6");

            string[] choices =
            {
                "1. Book a Room",
                "2. Vacate a Room",
                "3. Display All Rooms",
                "4. Vacate All Rooms",
                "5. Quit"
            };

            int choice = SimpleIO.GetChoice(choices);

            switch (choice)
            {
            case 1:
                motel.Book(1, 2);
                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Ham3a/BNU-Comp-Hamza
        private static void TestBook()
        {
            Book book = new Book();

            SimpleIO.WriteTitle("Horror Storey", "Task 4.1");

            //book.GetDetails();
            book.WriteChapter1();
            book.WriteChapter2();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Ham3a/BNU-Comp-Hamza
        /// <summary>
        /// Task 4.1 Create a Converter and check that it converts between
        /// miles and feet using double numbers
        /// </summary>
        public static void TestDistanceConverter()
        {
            double miles = 1;
            double feet  = 0;

            Console.WriteLine("Derek's Distance Converter");

            DistanceConverter converter = new DistanceConverter();

            int choice = 3;

            string[] choices = new string[]
            {
                "1. Convert Miles to Feet",
                "2. Convert Feet to Miles",
                "3. Quit Test"
            };

            do
            {
                choice = SimpleIO.GetChoice(choices);

                if (choice == 1)
                {
                    miles = converter.GetDouble("Miles");
                    feet  = converter.ToFeet(miles);

                    Console.WriteLine("The no of miles = " + miles);
                    Console.WriteLine("The no of feet  = " + feet);
                }
                else if (choice == 2)
                {
                    feet  = converter.GetDouble("Feet");
                    miles = converter.ToMiles(feet);

                    Console.WriteLine("The no of feet  = " + feet);
                    Console.WriteLine("The no of miles = " + miles);
                }
            } while (choice != 3);
        }