示例#1
0
        private void agregarTipoBomba()
        {
            Clear();
            WriteTitle("Administracion de Bombas");
            WriteTitle("Tipo de Bomba");
            WriteLine("1. Super");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una Opcion==>");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                agregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                agregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                agregarElemento(diesel);
            }
        }
示例#2
0
        public static Car creator(int numberOfWheels, String carBrand, String fuelType, int maxSpeed)
        {
            Car car;

            switch (fuelType)
            {
            case "diesel": car = new Diesel(numberOfWheels, maxSpeed); break;

            case "petrol": car = new Petrol(numberOfWheels, maxSpeed); break;

            case "electricity": car = new Electricity(numberOfWheels, maxSpeed); break;

            default: car = new Car(numberOfWheels, carBrand, fuelType, maxSpeed); return(car);
            }

            switch (carBrand)
            {
            case "peel": car = new PeelP50(car); break;

            case "audi": car = new Audi(car); break;

            case "nissan": car = new Nissan(car); break;

            case "tesla": car = new Tesla(car); break;

            default: return(car);
            }

            return(car);
        }
        private void agregarTipoBomba()  // se crea private porque sera utilizada dentro de la clase
        {
            WriteTitle("Tipo de Bomba");
            WriteLine("1. Super");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una opcion ==>");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                AgregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                AgregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                AgregarElemento(diesel);
            }
        }
示例#4
0
        private void AgregarTipoBomba()
        {
            byte opcion = 0;

            WriteTitle("Tipo de Bomba");
            WriteLine("1. Súper");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una opción ==> ");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                AgregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                AgregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                AgregarElemento(diesel);
            }
        }
示例#5
0
        public Detalle_Pedido(string json)
        {
            InitializeComponent();
            elegido = JsonConvert.DeserializeObject <Pedido>(json);

            if (elegido.Estatus.Equals("A"))
            {
                elegido.OracionEstatus = "Agendado";
                elegido.OracionImagen  = "confirmado.png";
            }

            if (elegido.Estatus.Equals("C"))
            {
                elegido.OracionEstatus = "Cancelado";
                elegido.OracionImagen  = "cancel.png";
            }

            elegido.TotalLitros    += " Totales";
            elegido.OracionMagna   += " Magna";
            elegido.OracionPremium += " Premium";
            elegido.OracionDiesel  += " Diesel";

            ImagenEstado.SetBinding(Image.SourceProperty, "OracionImagen");
            ImagenEstado.BindingContext = elegido;

            Confirmado.SetBinding(Label.TextProperty, "OracionEstatus");
            Confirmado.BindingContext = elegido;

            Folio.SetBinding(Label.TextProperty, "Folio_Pedido");
            Folio.BindingContext = elegido;

            ValorEstacion.SetBinding(Label.TextProperty, "Nombre_Estacion");
            ValorEstacion.BindingContext = elegido;

            FechaAgendada.SetBinding(Label.TextProperty, "OracionFecha");
            FechaAgendada.BindingContext = elegido;

            Total.SetBinding(Label.TextProperty, "TotalLitros");
            Total.BindingContext = elegido;

            Diesel.SetBinding(Label.TextProperty, "OracionDiesel");
            Diesel.BindingContext = elegido;

            Premium.SetBinding(Label.TextProperty, "OracionPremium");
            Premium.BindingContext = elegido;

            Magna.SetBinding(Label.TextProperty, "OracionMagna");
            Magna.BindingContext = elegido;


            ValorAutanque.SetBinding(Label.TextProperty, "Autotanque");
            ValorAutanque.BindingContext = elegido;

            FechaRegistro.SetBinding(Label.TextProperty, "OracionRegistro");
            FechaRegistro.BindingContext = elegido;
        }
示例#6
0
        static void Main(string[] args)
        {
            Petroleum petCar = new Petrol();

            petCar._IVehical = new Baleno();
            petCar.UsePetroleum();

            Petroleum dieselCar = new Diesel();

            dieselCar._IVehical = new Baleno();
            dieselCar.UsePetroleum();
        }
示例#7
0
文件: Program.cs 项目: helen612/OOP
    public override bool Equals(object obj)
    {
        if (obj == null)
        {
            return(false);
        }
        Diesel m = obj as Diesel; // возвращает null если объект нельзя привести к типу

        if (m as Diesel == null)
        {
            return(false);
        }
        return(base.Equals(obj) && m.Type == this.Type && m.TypeEngine == this.TypeEngine && m.Volume1 == this.Volume1);
    }
示例#8
0
        static void Main_2(string[] args)
        {
            mycar toyotaCar1 = new toyota();

            toyotaCar1.ManufactureCar();
            Console.WriteLine(toyotaCar1 + "\n");
            Diesel carWithDieselEngine = new Diesel(toyotaCar1);

            carWithDieselEngine.ManufactureCar();
            Console.WriteLine();
            mycar  toyotaCar2          = new toyota();
            Petrol carWithPetrolEngine = new Petrol(toyotaCar2);

            carWithPetrolEngine.ManufactureCar();
            Console.ReadKey();
        }
示例#9
0
        static void Main(string[] args)
        {
            Vehiculo moto = new Motocicleta();
            Vehiculo auto = new Automovil();

            MostrarCaracteristicas(moto);
            MostrarCaracteristicas(auto);
            Console.ReadKey();

            moto = new Gasolina(moto);
            auto = new Diesel(auto);

            MostrarCaracteristicas(moto);
            MostrarCaracteristicas(auto);

            Console.ReadKey();
        }
示例#10
0
文件: Program.cs 项目: helen612/OOP
    static void Main(string[] args)
    {
        InternalCombustionEngine Engine1  = new InternalCombustionEngine("Двигатель внутреннего сгорания", 25, 1999, "Бензин", "Поршневой двигатель", 1500);
        Diesel                   Engine2  = new Diesel("Дизель", 30, 1995, "Грузовик", "Четырёхтактный двигатель", 1700);
        TurboJetEngine           Engine3  = new TurboJetEngine("Турбореактивный двигатель", 30, 2011, 40, 35, 25);
        TurboJetEngine           Engine4  = new TurboJetEngine("Турбореактивный двигатель", 32, 2014, 30, 21, 13);
        Diesel                   Engine5  = new Diesel("Дизель", 30, 1996, "Легковой", "Трехтактный двигатель", 1700);
        InternalCombustionEngine Engine6  = new InternalCombustionEngine("Двигатель внутреннего сгорания", 24, 1999, "Бензин", "Поршневой двигатель", 1500);
        TurboJetEngine           Engine7  = new TurboJetEngine("Турбореактивный двигатель", 32, 2014, 30, 21, 13);
        TurboJetEngine           Engine8  = new TurboJetEngine("Турбореактивный двигатель", 30, 2005, 28, 35, 25);
        Diesel                   Engine9  = new Diesel("Дизель", 30, 1995, "Мотоцикл", "Четырёхтактный двигатель", 1700);
        Diesel                   Engine10 = new Diesel("Дизель", 30, 1995, "Автобус", "Четырёхтактный двигатель", 1700);
        Diesel                   Engine11 = new Diesel("Дизель", 30, 1995, "Автобус", "Четырёхтактный двигатель", 1700);

        Engine[] arr = new Engine[100];
        arr[0]  = Engine1;
        arr[1]  = Engine2;
        arr[2]  = Engine3;
        arr[3]  = Engine4;
        arr[4]  = Engine5;
        arr[5]  = Engine6;
        arr[6]  = Engine7;
        arr[7]  = Engine8;
        arr[8]  = Engine9;
        arr[9]  = Engine10;
        arr[10] = Engine11;
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(arr[i]);
        }
        Diesel Naiti = new Diesel("Дизель", 30, 1995, "Автобус", "Четырёхтактный двигатель", 1700);

        for (int i = 0; i < 10; i++)
        {
            if (arr[i].Equals(Naiti) == true)
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("найденный объект");
                Console.WriteLine(arr[i]);
            }
        }

        Console.ReadKey();
    }
示例#11
0
        static void Main(string[] args)
        {
            IMotor   naftero  = new Naftero();
            Vehiculo Fiat1500 = new Fiat1500(naftero, 300);

            Fiat1500.MostrarCaracteristicas();
            Fiat1500.Acelerar(5.9d);
            Fiat1500.Frenar();
            Console.ReadLine();

            IMotor   motorDiesel = new Diesel();
            Vehiculo kangoo      = new RenaultKangoo(motorDiesel, true);

            kangoo.MostrarCaracteristicas();
            kangoo.Acelerar(2.4d);
            kangoo.Frenar();
            Console.ReadLine();
        }
示例#12
0
        static void Main(string[] args)
        {
            Car  c = new Car("353", "1");
            Bike b = new Bike("8864", "2");

            Console.WriteLine(c.GetVehicleDetails());
            Console.WriteLine(c.GetPrice());
            Console.WriteLine("Consolidate Price is " + c.GetConsolidatePrice());
            Console.WriteLine("Bike Details");
            Console.WriteLine(b.GetVehicleDetails());
            Console.WriteLine(b.GetPrice());

            //Liskovs Substitution
            // A a=new B();
            Console.WriteLine("Assigning Car object to Vehicle");
            Vehicle v = c;

            Console.WriteLine(v.GetVehicleDetails());
            Console.WriteLine(v.GetPrice());
            Console.WriteLine("Consolidate Price is " + v.GetConsolidatePrice());

            IEngine a = new FiatEngine();

            TestEngine(a);

            a = new ToyotaEngine();
            TestEngine(a);

            a = new LocalEngine();
            TestEngine(a);

            FuelBase fb = new Petrol();

            DisplayFuelDetails(fb);

            fb = new Diesel();
            DisplayFuelDetails(fb);
        }
示例#13
0
        public Detalle_Pedido(string json)
        {
            InitializeComponent();
            elegido = JsonConvert.DeserializeObject <Pedido>(json);

            elegido.TotalLitros    += " Totales";
            elegido.OracionMagna   += " Magna";
            elegido.OracionPremium += " Premium";
            elegido.OracionDiesel  += " Diesel";

            Folio.SetBinding(Label.TextProperty, "Folio_Pedido");
            Folio.BindingContext = elegido;

            ValorEstacion.SetBinding(Label.TextProperty, "Nombre_Estacion");
            ValorEstacion.BindingContext = elegido;

            FechaAgendada.SetBinding(Label.TextProperty, "Fecha_Programada");
            FechaAgendada.BindingContext = elegido;

            Total.SetBinding(Label.TextProperty, "TotalLitros");
            Total.BindingContext = elegido;

            Diesel.SetBinding(Label.TextProperty, "OracionDiesel");
            Diesel.BindingContext = elegido;

            Premium.SetBinding(Label.TextProperty, "OracionPremium");
            Premium.BindingContext = elegido;

            Magna.SetBinding(Label.TextProperty, "OracionMagna");
            Magna.BindingContext = elegido;


            ValorAutanque.SetBinding(Label.TextProperty, "Autotanque");
            ValorAutanque.BindingContext = elegido;

            FechaRegistro.SetBinding(Label.TextProperty, "Fecha_Registro");
            FechaRegistro.BindingContext = elegido;
        }
示例#14
0
    void Awake()
    {
        text.text = "Press A to turn LEFT and D to turn RIGHT\nOutput displayed in the debug console";

        //Human plus gas
        IFuel   gas         = new Gas();
        IDriver humanDriver = new Human();

        m_PlayerCar.SetFuel(gas);
        m_PlayerCar.SetDriver(humanDriver);
        m_PlayerCar.FuelCar();

        //AI plus electric
        IFuel   electric = new Electric();
        IDriver artificialIntelligence = new AI();

        m_AICar.SetFuel(electric);
        m_AICar.SetDriver(artificialIntelligence);
        m_AICar.FuelCar();

        //Millionaire plus rainbow
        IFuel   rainbow     = new Rainbow();
        IDriver millionaire = new Millionaire();

        m_FakeCar.SetFuel(rainbow);
        m_FakeCar.SetDriver(millionaire);
        m_FakeCar.FuelCar();

        //Trucker plus diesel
        IFuel   diesel  = new Diesel();
        IDriver trucker = new Trucker();

        m_TruckerTruck.SetFuel(diesel);
        m_TruckerTruck.SetDriver(trucker);
        m_TruckerTruck.FuelCar();
    }
示例#15
0
 public IActionResult Diesel(Diesel model) => Save(model);
示例#16
0
        static void Main(string[] args)
        {
            Financiacion pago = new Financiacion();

            pago.Años    = 5;
            pago.Entrada = 3000;
            pago.Interes = 11.5;

            Gasolinera punto = Gasolinera.GetInstance();

            punto.PrecioGasolina = 1.08;
            punto.PrecioDiesel   = 0.99;

            Gasolina fiesta13 = new Gasolina();

            fiesta13.Caballos = 70;
            fiesta13.Consumo  = 8.1;
            fiesta13.Precio   = 13030.0;

            Diesel fiesta14 = new Diesel();

            fiesta14.Caballos = 68;
            fiesta14.Consumo  = 5.8;
            fiesta14.Precio   = 13635.0;



            System.Console.WriteLine(Coche.ResolverObtenerKilometros(fiesta13, fiesta14, pago));
            Gasolina fiesta16 = new Gasolina();

            fiesta16.Caballos = 100;
            fiesta16.Consumo  = 8.8;
            fiesta16.Precio   = 14635.0;

            Diesel fiesta16g = new Diesel();

            fiesta16g.Caballos = 90;
            fiesta16g.Consumo  = 5.2;
            fiesta16g.Precio   = 14935.0;

            System.Console.WriteLine(Coche.ResolverObtenerKilometros(fiesta16, fiesta16g, pago));

            XmlDataDocument doc = new XmlDataDocument();

            doc.Load("../../../CochesRentables/BaseCoches.xml");

            foreach (XmlNode marcas in doc.FirstChild.NextSibling.ChildNodes)
            {
                foreach (XmlElement modelos in marcas.ChildNodes)
                {
                    foreach (XmlElement motor in modelos.ChildNodes)
                    {
                        string versionmotor = motor.Name.ToLower();
                        if (versionmotor.Equals("gasolina"))
                        {
                            foreach (XmlElement versiones in motor.ChildNodes)
                            {
                                Coche c = new Gasolina(versiones);
                            }
                        }
                        else if (versionmotor.Equals("diesel"))
                        {
                        }
                        else
                        {
                        }
                    }
                }
            }
            XmlNodeList personas = doc.GetElementsByTagName("Gasolina");

            System.Console.ReadLine();
        }
示例#17
0
文件: Truck.cs 项目: 0916174/INFDEV
 public Truck(Diesel fuel)
 {
     this.Fuel = fuel;
 }
示例#18
0
 public Truck()
 {
     tank = new Diesel();
 }
 public void Post([FromBody] Diesel request)
 {
     todoRepository.Add(request);
 }