コード例 #1
0
        public static void Main(string[] args)
        {
            var skdc     = new Vehicle(2, 5);
            var sportCar = new SportCar(2, 4);

            sportCar.Drive(1);
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            SportCar car = new SportCar(10, 100);

            car.Drive(10);
            System.Console.WriteLine(car.Fuel);
        }
コード例 #3
0
ファイル: example.cs プロジェクト: 8Observer8/MyProjects
    static void Main()
    {
        SportCar sc1 = new SportCar("Silvia", -1230, 4.25, 440, "RWD", "Drift");
        SportCar sc2 = new SportCar("Impreza", 1380, 4.43, 506, "4WD", "Drag Racing");
        Plane    p1  = new Plane("Boeing", 290000, 73.9, 9000, 60.9);

        Console.WriteLine("Information about the car \"sc1\"");
        sc1.ShowDim();
        sc1.ShowDrive();
        sc1.ShowRaceType();
        Console.WriteLine("HorsePower per (kg / 1000): {0}", sc1.HpPerTon());

        Console.WriteLine();

        Console.WriteLine("Information about the car \"sc2\"");
        sc2.ShowDim();
        sc2.ShowDrive();
        sc2.ShowRaceType();
        Console.WriteLine("HorsePower per (kg / 1000): {0}", sc2.HpPerTon());

        Console.WriteLine();

        Console.WriteLine("Information about the plane \"p1\"");
        p1.ShowDim();
        p1.ShowWings();

        Console.ReadLine();
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: Habi95/CSharp
        public static void BuildYourSportCar(List <Producer> producers, List <model.Type> types, Person shopOwner, List <Car> ShowCars)
        {
            Console.WriteLine("Folgende Hersteller stehen zur verfügung:");
            for (int i = 0; i < producers.Count; i++)
            {
                Console.WriteLine(i + ": " + producers.ElementAt(i));
            }
            Console.WriteLine("\nFolgende Typen: ");
            Console.WriteLine($"0: {types.ElementAt(0)}  \n1: {types.ElementAt(1)}  \n3: {types.ElementAt(3)}  \n4: {types.ElementAt(4)} \n");
            Console.WriteLine("Hersteller wählen:");
            int choiceProducer = Console.ReadLine().ReadInt();

            Console.WriteLine("Serie wählen:");
            string choiceName = Console.ReadLine();

            Console.WriteLine("Typ wählen:");
            int choiceType = Console.ReadLine().ReadInt();

            Console.WriteLine("Baujahr wählen:");
            int choiceYear = Console.ReadLine().ReadInt();

            Console.WriteLine("PS wählen:");
            int choiceHp = Console.ReadLine().ReadInt();

            Console.WriteLine("Farbe wählen:");
            string choiceColor = Console.ReadLine();

            Console.WriteLine("Price wählen:");
            decimal  choicePrice = Console.ReadLine().ReadDecimal();
            SportCar mySportCar  = new SportCar(types.ElementAt(choiceType), choiceName, producers.ElementAt(choiceProducer), choiceYear, choiceHp, choiceColor, choicePrice, shopOwner);

            ShowCars.Add(mySportCar);
        }
コード例 #5
0
ファイル: StartUp.cs プロジェクト: georgievGV/lvl1
        public static void Main(string[] args)
        {
            SportCar vehicle = new SportCar(250, 22.8);

            vehicle.Drive(55.9);
            System.Console.WriteLine(vehicle.Fuel);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: MrNerf/Advanced_CS_Lessons
        private static void Main()
        {
            Console.Title           = "Понятие рефлексии";
            Console.ForegroundColor = ConsoleColor.Green;
            var sportCar = new SportCar("Mazda", 175, 210);
            var type     = sportCar.GetType();

            Console.WriteLine($"Sport car type: {type}");
            var type2 = typeof(SportCar);

            Console.WriteLine($"Sport car type: {type2}");
            try
            {
                var type3 = Type.GetType("CarLibrary.SportCar, CarLibrary", true, false);
                Console.WriteLine($"Sport car type: {type3}");
                var type4 = Type.GetType("CarLibrary.car, CarLibrary", true, true);
                Console.WriteLine($"Sport car type: {type4}");
                var type5 = Type.GetType("CarLibrary.car, CarLibrary", true, false);
                Console.WriteLine($"Sport car type: {type5}");
            }
            catch (TypeLoadException e)
            {
                Console.WriteLine($"Тип исключения {e.TypeName}, сообщение исключения: {e.Message}");
            }

            Console.ReadLine();
        }
コード例 #7
0
        public static void Main(string[] args)
        {
            SportCar car = new SportCar(300, 20);

            System.Console.WriteLine(car.FuelConsumption);
            car.Drive(2);
        }
コード例 #8
0
        public static void Main(string[] args)
        {
            var vehicle = new SportCar(250, 1125.00);

            vehicle.Drive(70);

            System.Console.WriteLine(vehicle.Fuel);
        }
コード例 #9
0
        static void Main(string[] args)
        {
            SportCar car = new SportCar();

            car.CarInfo();

            Console.ReadLine();
        }
コード例 #10
0
ファイル: StartUp.cs プロジェクト: MartiHr/Softuni
        public static void Main(string[] args)
        {
            Car            car            = new Car(5, 5);
            Motorcycle     motorcycle     = new Motorcycle(5, 5);
            SportCar       sportCar       = new SportCar(5, 5);
            RaceMotorcycle raceMotorcycle = new RaceMotorcycle(5, 5);

            System.Console.WriteLine(car.FuelConsumption);
        }
コード例 #11
0
        private static void Main()
        {
            Console.Title           = "Использование библиотеки, размещенной в GAC";
            Console.ForegroundColor = ConsoleColor.DarkRed;
            var sportCar = new SportCar("Audi", 210, 270);

            sportCar.TurboBoost();
            Console.ReadLine();
        }
コード例 #12
0
        private Car CreateSportCar()
        {
            var sportCar = new SportCar();

            FillCarFields(sportCar);
            Console.WriteLine("Horsepower: ");
            sportCar.HorsePower = int.Parse(Console.ReadLine());
            return(sportCar);
        }
コード例 #13
0
        public static void Main(string[] args)
        {
            FamilyCar newCar = new FamilyCar(100, 100);

            newCar.Drive(25);

            SportCar sportCar = new SportCar(100, 100);

            sportCar.Drive(10);
        }
コード例 #14
0
        public void EqualsTest()
        {
            Automobile automobile1 = new SportCar("acura", "nsx", (Colors)3, (FuelTypes)1, 307, 570, 3.5, (ExhaustSystemsBrands)5);
            Automobile automobile2 = new SportCar("acura", "nsx", (Colors)3, (FuelTypes)1, 307, 570, 3.5, (ExhaustSystemsBrands)5);
            bool       expected    = true;

            bool actual = automobile1.Equals(automobile2);

            Assert.AreEqual(expected, actual);
        }
コード例 #15
0
        static void Main(string[] args)
        {
            SportCar sCar = new SportCar(80, 3000);

            sCar.Drive(30);

            RaceMotorcycle rM = new RaceMotorcycle(120, 460.987);

            rM.Drive(78.01);
        }
コード例 #16
0
        static void Main(string[] args)
        {
            SportCar viper = new SportCar("Viper", 11, 14);

            viper.TurboBoost();
            MiniVan mv = new MiniVan();

            mv.TurboBoost();
            Console.WriteLine();
        }
コード例 #17
0
        public static void Main(string[] args)
        {
            Car car        = new Car(100, 3.3);
            Car sportCar   = new SportCar(100, 3.3);
            var motorcycle = new Motorcycle(20, 60);

            System.Console.WriteLine(car.FuelConsumption);
            System.Console.WriteLine(sportCar.FuelConsumption);
            System.Console.WriteLine(motorcycle.FuelConsumption);
        }
コード例 #18
0
        public static void Main()
        {
            FamilyCar familyCar = new FamilyCar(100, 10);

            // System.Console.WriteLine(familyCar.FuelConsumption);

            SportCar sportCar = new SportCar(100, 20);

            System.Console.WriteLine(sportCar.FuelConsumption);
        }
コード例 #19
0
        static void Main(string[] args)
        {
            Game     g   = new Game();
            SportCar sp1 = new SportCar();
            SportCar sp2 = new SportCar();

            g.ReadyToStart(sp1, sp2);

            Console.ReadKey();
        }
コード例 #20
0
    static void Main()
    {
        Auto obj1 = new Auto();

        obj1.AutoInfo();

        SportCar obj = new SportCar();

        obj.InfoSportCar();

        Console.ReadLine();
    }
コード例 #21
0
ファイル: AppBuilder.cs プロジェクト: SenkoVlad/Patterns
        public void Show()
        {
            System.Console.WriteLine(SportCarManual.ToString());
            System.Console.WriteLine();
            System.Console.WriteLine(SportCar.ToString());

            System.Console.WriteLine("----------------------------------------------------------");

            System.Console.WriteLine(SimpleCarManual.ToString());
            System.Console.WriteLine();
            System.Console.WriteLine(SimpleCar.ToString());
        }
コード例 #22
0
        static void Main(string[] args)
        {
            Auto auto = new Auto();

            auto.AutoInfo();

            SportCar sportCar = new SportCar();

            sportCar.SportCarInfo();


            Console.ReadKey();
        }
コード例 #23
0
        private static void Main()
        {
            Console.Title           = "Пример консольного клиента для сторонней библиотеки";
            Console.ForegroundColor = ConsoleColor.Cyan;
            var sportCar = new SportCar("Audi", 210, 270);

            sportCar.TurboBoost();

            var miniVan = new MiniVan();

            miniVan.TurboBoost();
            Console.ReadLine();
        }
コード例 #24
0
ファイル: FormCar.cs プロジェクト: Ducktyst/tech_program
        /// <summary>
        /// Обработка нажатия кнопки "Создать"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();

            _car = new SportCar();
            bool sportLine = false;

            if (rnd.Next(2) % 2 == 0)
            {
                sportLine = true;
            }
            _car.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.Blue, Color.Yellow, sportLine, true, true, true);
            _car.SetPosition(rnd.Next(10, 100), rnd.Next(100, 200), pictureBoxCars.Width, pictureBoxCars.Height);
            Draw();
        }
コード例 #25
0
        public static void Main(string[] args)
        {
            Vehicle test1 = new Vehicle(100, 50);

            SportCar test2 = new SportCar(100, 50);
            Car      test3 = new Car(100, 50);

            test1.Drive(5);
            test2.Drive(5);
            test3.Drive(5);

            System.Console.WriteLine(test1.Fuel);
            System.Console.WriteLine(test2.Fuel);
            System.Console.WriteLine(test3.Fuel);
        }
コード例 #26
0
        public Client()
        {
            CarFactory factory   = new FactoryRayHorses();
            SportCar   sportCar  = factory.CreateSportCar();
            NormalCar  normalCar = factory.CreateNormalCar();

            sportCar.ShowSportCar();
            normalCar.ShowNormalCar();

            factory   = new FactoryThunderHorses();
            sportCar  = factory.CreateSportCar();
            normalCar = factory.CreateNormalCar();

            sportCar.ShowSportCar();
            normalCar.ShowNormalCar();
        }
コード例 #27
0
        static void Main(string[] args)
        {
            //List<Journal> journals = new List<Journal>();
            //journals.Add(new WayBillInvoice());
            //foreach (Journal jour in journals)
            //{
            //    jour.EnterBasedTaxInvoice(15);
            //}


            //Liskov
            Car cars = new SportCar();

            TestSpeed(cars);
            //cars.MaxSpeedMile = 300;
        }
コード例 #28
0
    static void Main()
    {
        Auto babyAuto = new Auto();

        babyAuto.AutoInfo();

        SportCar sportMan = new SportCar();

        sportMan.SportCarInfo();

        MiniCar styleIsEverything = new MiniCar();

        styleIsEverything.MiniCarInfo();

        Console.ReadLine();
    }
コード例 #29
0
        static void Main(string[] args)
        {
            // This is to show how to add Dll library usually
            // creating instance of sport car
            SportCar sportcar = new SportCar("Viper", 240, 40);

            sportcar.Acceleration();

            // creating instance of minivan
            MiniVan minivan = new MiniVan();

            minivan.Acceleration();

            // go to next project to see how we can use the same assembly using reflection methods
            Console.ReadKey();
        }
コード例 #30
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;

            SellController sellController = new SellController();
            Car            car            = new Car()
            {
                Model            = "Ford Focus II",
                IssueYear        = 2007,
                Price            = "245 000 руб",
                Equipment        = "Хэтчбек 5 дв.",
                ProducingCountry = "Россия",
                SaleDate         = DateTime.Now,
                Buyer            = "Иванов Иван Иванович"
            };
            Car car1 = new SportCar()
            {
                Seconds            = "5",
                EngineDisplacement = "5 литров",
                Power            = "200 лошадиных сил",
                Model            = "Ford Focus II",
                IssueYear        = 2007,
                Price            = "245 000 руб",
                Equipment        = "Хэтчбек 5 дв.",
                ProducingCountry = "Россия",
                SaleDate         = DateTime.Now,
                Buyer            = "Иванов Иван Иванович"
            };
            Car car2 = new UsedCar()
            {
                SafetyDegree     = "Не битая",
                Owner            = "Петров Петр Петрович",
                Mileage          = "100 000 км",
                Model            = "Ford Focus II",
                IssueYear        = 2007,
                Price            = "245 000 руб",
                Equipment        = "Хэтчбек 5 дв.",
                ProducingCountry = "Россия",
                SaleDate         = DateTime.Now,
                Buyer            = "Иванов Иван Иванович"
            };

            sellController.SellCar(car);
            sellController.SellCar(car1);
            sellController.SellCar(car2);
            sellController.PrintList();
        }
コード例 #31
0
ファイル: example.cs プロジェクト: 8Observer8/MyProjects
	static void Main()
	{
		SportCar sc1  = new SportCar("Silvia", -1230, 4.25, 440, "RWD", "Drift");
		SportCar sc2  = new SportCar("Impreza", 1380, 4.43, 506, "4WD", "Drag Racing");
		Plane p1 = new Plane("Boeing", 290000, 73.9, 9000, 60.9);

		Console.WriteLine("Information about the car \"sc1\"");
		sc1.ShowDim();
		sc1.ShowDrive();
		sc1.ShowRaceType();
		Console.WriteLine("HorsePower per (kg / 1000): {0}", sc1.HpPerTon());

		Console.WriteLine();

		Console.WriteLine("Information about the car \"sc2\"");
		sc2.ShowDim();
		sc2.ShowDrive();
		sc2.ShowRaceType();
		Console.WriteLine("HorsePower per (kg / 1000): {0}", sc2.HpPerTon());

		Console.WriteLine();

		Console.WriteLine("Information about the plane \"p1\"");
		p1.ShowDim();
		p1.ShowWings();

		Console.ReadLine();
	}
コード例 #32
0
 public void Setup()
 {
     sportcar = new SportCar();
     familycar = new FamilyCar();
 }
コード例 #33
0
ファイル: Rent.cs プロジェクト: Teddymannen/WIN14_TDD_Agile
    public double CalcTotal(double milage, double days, string c)
    {
        var total = 0.0;
        try
        {
            if (milage > 0 && days > 0)
                if (c == "SportCar")
                {
                    var car = new SportCar();
                    total = car.DailyCost * days + car.MilageCost * milage + car.ExtraInsurance + penaltyCost + discount;
                    return total;
                }
                else if (c == "FamilyCar")
                {
                    var car = new FamilyCar();
                    total = car.DailyCost * days + car.MilageCost * milage + car.ExtraInsurance + penaltyCost + discount;
                    return total;
                }
                else
                {
                    MessageBox.Show("Du har ej angivit godkänd typ av bil");
                }
            //else
            //    MessageBox.Show("0 i värde är ej tillåtet");

        }
        catch (FormatException)
        {

            MessageBox.Show("You have entered non-numeric characters");

        }
        return total;
    }
コード例 #34
0
ファイル: Rent.cs プロジェクト: Teddymannen/WIN14_TDD_Agile
    public bool ChooseCar(string carType)
    {
        if(carType == null)
        {
            throw new ArgumentNullException();
        }

        if(carType == "familycar")
        {
            SelectedCar = new FamilyCar();
            return true;
            // return familyCar;
        }
        else if(carType == "sportcar")
        {
            SelectedCar = new SportCar();
            return true;
            //return sportCar;
        }
        else
        {
            throw new ArgumentException(String.Format("{0} är ingen giltig biltyp", carType));
        }
    }
コード例 #35
0
ファイル: Rent.cs プロジェクト: Teddymannen/WIN14_TDD_Agile
 public Rent()
 {
     familyCar = new FamilyCar();
     sportCar = new SportCar();
     StartDate = DateTime.Today;
 }