コード例 #1
0
ファイル: Program.cs プロジェクト: hihilla/csharp3
        private static GarageLogic.Truck newTruck(GarageLogic.Garage i_Garage)
        {
            GarageLogic.Truck truck = GarageLogic.Creator.CreateNewTruck();
            setVehiclesMembers(i_Garage, truck);

            return(truck);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: hihilla/csharp3
        private static void insertNewVehicle(GarageLogic.Garage i_Garage)
        {
            Console.WriteLine("To insert new elecrtic motorcycle, Enter 1, ");
            Console.WriteLine("To insert new fuel-based motorcycle, Enter 2, ");
            Console.WriteLine("To insert new elecrtic car, Enter 3");
            Console.WriteLine("To insert new fuel-based car, Enter 4");
            Console.WriteLine("To insert new truck, Enter 5");

            int chosenVehiclel;

            int.TryParse(Console.ReadLine(), out chosenVehiclel);

            while (chosenVehiclel < 1 || chosenVehiclel > 5)
            {
                Console.WriteLine("Invalid input, please choose valid vehicle <1-5>");
                int.TryParse(Console.ReadLine(), out chosenVehiclel);
            }

            switch (chosenVehiclel)
            {
            case 1:
                GarageLogic.Motorcycle electriMotorcyle = newMotorcycle(true, i_Garage);
                break;

            case 2:
                GarageLogic.Motorcycle fueledMotorcycle = newMotorcycle(false, i_Garage);
                break;

            case 3:
                GarageLogic.Car electricCar = newCar(true, i_Garage);
                break;

            case 4:
                GarageLogic.Car fueledCar = newCar(false, i_Garage);
                break;

            case 5:
                GarageLogic.Truck truck = newTruck(i_Garage);
                break;
            }
        }