public static void Main(string[] args) { var skdc = new Vehicle(2, 5); var sportCar = new SportCar(2, 4); sportCar.Drive(1); }
public static void Main(string[] args) { SportCar car = new SportCar(10, 100); car.Drive(10); System.Console.WriteLine(car.Fuel); }
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(); }
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); }
public static void Main(string[] args) { SportCar vehicle = new SportCar(250, 22.8); vehicle.Drive(55.9); System.Console.WriteLine(vehicle.Fuel); }
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(); }
public static void Main(string[] args) { SportCar car = new SportCar(300, 20); System.Console.WriteLine(car.FuelConsumption); car.Drive(2); }
public static void Main(string[] args) { var vehicle = new SportCar(250, 1125.00); vehicle.Drive(70); System.Console.WriteLine(vehicle.Fuel); }
static void Main(string[] args) { SportCar car = new SportCar(); car.CarInfo(); Console.ReadLine(); }
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); }
private static void Main() { Console.Title = "Использование библиотеки, размещенной в GAC"; Console.ForegroundColor = ConsoleColor.DarkRed; var sportCar = new SportCar("Audi", 210, 270); sportCar.TurboBoost(); Console.ReadLine(); }
private Car CreateSportCar() { var sportCar = new SportCar(); FillCarFields(sportCar); Console.WriteLine("Horsepower: "); sportCar.HorsePower = int.Parse(Console.ReadLine()); return(sportCar); }
public static void Main(string[] args) { FamilyCar newCar = new FamilyCar(100, 100); newCar.Drive(25); SportCar sportCar = new SportCar(100, 100); sportCar.Drive(10); }
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); }
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); }
static void Main(string[] args) { SportCar viper = new SportCar("Viper", 11, 14); viper.TurboBoost(); MiniVan mv = new MiniVan(); mv.TurboBoost(); Console.WriteLine(); }
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); }
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); }
static void Main(string[] args) { Game g = new Game(); SportCar sp1 = new SportCar(); SportCar sp2 = new SportCar(); g.ReadyToStart(sp1, sp2); Console.ReadKey(); }
static void Main() { Auto obj1 = new Auto(); obj1.AutoInfo(); SportCar obj = new SportCar(); obj.InfoSportCar(); Console.ReadLine(); }
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()); }
static void Main(string[] args) { Auto auto = new Auto(); auto.AutoInfo(); SportCar sportCar = new SportCar(); sportCar.SportCarInfo(); Console.ReadKey(); }
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(); }
/// <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(); }
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); }
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(); }
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; }
static void Main() { Auto babyAuto = new Auto(); babyAuto.AutoInfo(); SportCar sportMan = new SportCar(); sportMan.SportCarInfo(); MiniCar styleIsEverything = new MiniCar(); styleIsEverything.MiniCarInfo(); Console.ReadLine(); }
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(); }
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(); }
public void Setup() { sportcar = new SportCar(); familycar = new FamilyCar(); }
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; }
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)); } }
public Rent() { familyCar = new FamilyCar(); sportCar = new SportCar(); StartDate = DateTime.Today; }