static void Main(string[] args) { //Create a new car object Car car = new Car(); car.PrintData(); car.Model = "Datsun 100A"; car.Color = "Yellow"; car.Engine = 0.4; car.DoorCount = 2; car.Accelerate(); car.PrintData(); // create another car object string model = "Jeep"; Car car2 = new Car(model); car2.PrintData(); car2.Color = "Black"; car2.Engine = 5.0; car2.DoorCount = 4; car2.FuzzyDices = false; car2.Brake(); car2.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { // create one car instance Car car = new Car(); car.Model = "Audi"; car.Color = "Silver"; car.Engine = 2.0; car.FuzzyDices = false; car.Speed = 100; car.PrintData(); Car nascar = new Car("Toyota"); // Console.WriteLine("FuzzyDices = " + nascar.FuzzyDices); // Console.WriteLine("Model = " + nascar.Model); nascar.Speed = 200; nascar.Color = "Red"; nascar.Engine = 5.0; nascar.FuzzyDices = true; nascar.PrintData(); nascar.Accelerate(50); nascar.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { // create a new car object Car car = new Car(); car.PrintData(); car.Model = "Datsum 100A"; car.Color = "Yellow"; car.Engine = 0.4; car.DoorCount = 2; car.Accelerate(); //kutsuvan arvon voi myös laittaa sulkeisiin, silloin var-ohjelmassa pitää int-kutsua muuttaa ja lisätä se sen tunnisteeseen +5 kohdalle speed car.PrintData(); //create another car object string model = "Jeep"; Car car2 = new Car(model); car2.PrintData(); car2.Color = "Black"; car2.Engine = 5.0; car2.DoorCount = 4; car2.FuzzyDices = false; car2.Brake(); car2.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { { double temp = TemperatureConverter.FahrenheitToCelsius(200); // create a one car instance Car datsun = new Car("Datsun 100", "red", 1.0, true, 2); Car porsche = new Car("Porche 911 RS3", "silver", 3, false, 2); Car toyota = new Car("Toyota Avensis", "grey", 1.8, false, 5); datsun.Speed = 100; porsche.Speed = 280; toyota.Speed = 160; // display car data datsun.PrintData(); porsche.PrintData(); toyota.PrintData(); Console.ReadLine(); // accelerate, change car's speed value datsun.Accelerate(); // display car data again, notice changed speed value! datsun.PrintData(); Console.ReadLine(); } }
static void Main(string[] args) { // create a one car instance Car datsun = new Car(); datsun.Model = "Datsun 100A"; datsun.Color = "red"; datsun.Engine = 1.0; datsun.Speed = 0; datsun.FuzzyDices = true; datsun.DoorCount = 2; // display car data datsun.PrintData(); Console.ReadLine(); // accelerate, change car's speed value datsun.Accelerate(); // display car data again, notice changed speed value! datsun.PrintData(); Console.ReadLine(); //luodaan porsche parametrillisella konstruktorilla (ei kaikkia parametreja) Car porsche = new Car("Boxter", "green", false); porsche.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { // create a new instance from Car class Car car = new Car(); car.PrintData(); car.Model = "Datsun 100A"; car.Colour = "Yellow"; car.Engine = 0.5; car.Speed = 10; car.FuzzyDice = true; car.DoorCount = 2; car.Accelerate(); car.PrintData(); car.Brake(7); Car.SomeProperty = 42; car.PrintData(); // create another car object string model = "Speedster"; Car nascar = new Car(model); nascar.PrintData(); nascar.Colour = "Black"; Console.WriteLine("Colour is " + nascar.Colour); }
static void Main(string[] args) { // create one Car instance Car car = new Car(); car.Model = "Audi"; car.Color = "White"; car.Engine = 2.0; car.FuzzyDices = false; car.Speed = 100; car.PrintData(); /*Console.WriteLine("FuzzyDices = " + car.FuzzyDices); * Console.WriteLine("Model = " + car.Model);*/ Car nascar = new Car("Toyota"); /*Console.WriteLine("FuzzyDices = " + nascar.FuzzyDices); * Console.WriteLine("Model = " + nascar.Model);*/ nascar.Speed = 200; nascar.Color = "Red"; nascar.Engine = 5.0; nascar.FuzzyDices = true; nascar.PrintData(); nascar.Accelerate(50); nascar.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { Car cart = new Car(); cart.Color = "Shitty brown"; cart.Engine = 1; cart.FuzzyDices = false; cart.Model = "BandwaGONE"; cart.PrintData(); Console.ReadLine(); cart.Accelerate(); cart.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { double temp = TemperatureConverter.FahrenheitToCelsius(200); Car datsun = new Car("Datsun 100A", "red", 1.0, true, 2); //Car toyota = new Car("Datsun 100A", "red", 1.0, true, 2); //Car porche = new Car("Datsun 100A", "red", 1.0, true, 2); datsun.Speed = 280; //toyota.Speed = 100; //porche.Speed = 190; // display car data datsun.PrintData(); Console.ReadLine(); // accelerate, change car's speed value datsun.Accelerate(); // display car data again, notice changed speed value! datsun.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { // create one car instance Car car = new Car(); car.Name = "Audi"; car.Tyres = 240; car.Speed = 100; car.PrintData(); Console.WriteLine(car.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Car datsun = new Car(); datsun.Model = "Datsuni"; datsun.Color = "red"; Car.SomeProperty = 10; datsun.PrintData(); Console.WriteLine("******************************"); datsun.Accelerate(); datsun.PrintData(); Console.WriteLine("******************************"); Car Audi = new Car("Audimies", "musta", 2.0); Car.SomeProperty = 200; Audi.PrintData(); Console.WriteLine("******************************"); datsun.PrintData(); }
static void Main(string[] args) { /* * TemperatureConverter converter = new TemperatureConverter(); * double temp = converter.FahrenheitToCelsius(200); */ double temp = TemperatureConverter.FahrenheitToCelsius(200); Console.WriteLine(temp); Car datsun = new Car("Datsun 100A", "red", 1.0, true, 2); Car porchse = new Car("Porsche 911 RS3", "silver", 3.2, false, 2); Car toyota = new Car("Camry", "red", 2.0, true, 4); datsun.Model = "Datsun 100A"; datsun.Color = "red"; datsun.EngineSize = 1.0; datsun.Speed = 0; datsun.FuzzyDices = true; datsun.DoorCount = 2; datsun.Speed = 100; porchse.Speed = 280; toyota.Speed = 160; // display car data datsun.PrintData(); Console.ReadLine(); // accelerate, change car's speed value datsun.Accelerate(); // display car data again, notice changed speed value! datsun.PrintData(); porchse.PrintData(); toyota.PrintData(); Console.ReadLine(); }
static void Main(string[] args) { double temp = Temperature.FahrenheitToCelsius(200); // create a one car instance Car datsun = new Car("Datsun 100A", "red", 1.0, true, 2); Car Porcshe = new Car("Porcshe 911A RS3", "silver", 3.2, false, 2); Car toyota = new Car("Toyota Camry", "blue", 2.0, true, 4); datsun.Speed = 100; Porcshe.Speed = 280; toyota.Speed = 160; // display car data datsun.PrintData(); Porcshe.PrintData(); toyota.PrintData(); Console.ReadLine(); // accelerate, change car's speed value datsun.Accelerate(); // display car data again, notice changed speed value! datsun.PrintData(); Console.ReadLine(); }