static void Main(string[] args) { // create one Car instance Car car = new Car(); car.Model = "Audi"; car.Color = "Black"; 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"); nascar.Speed = 200; nascar.Color = "red"; nascar.Engine = 5.0; nascar.FuzzyDices = true; nascar.Accelerate(50); 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 = "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 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) { /* * 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(); }