Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();

        }
Beispiel #4
0
 static void Main(string[] args)
 {
     Car car = new Car();
    // car.Speed = 300;
     Console.WriteLine("Car speed is " + car.Speed);
     Console.ReadLine();
 }
Beispiel #5
0
 static void Main(string[] args)
 {
     // create one car object
     Car car = new Car();
     car.Speed = 10000;
     car.Height = -1;
     Console.WriteLine("Speed is {0}", car.Speed);
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     // create a one car object
     Car car = new Car();
     car.Speed = 300;
     car.Height = 5.0;
     Console.WriteLine("Speed is {0} and height {1}", car.Speed, car.Height);
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            // create a car object
            Car car = new Car();
            car.Speed = 666;
            car.Height = 4.6;
            Console.WriteLine("Speed is {0} and Height {1}", car.Speed, car.Height);


                }
Beispiel #8
0
 static void Main(string[] args)
 {
     Car car = new Car();
     car.Speed = 30000000;
     car.Height = 5.5;
     Console.WriteLine("Speed is {0} and height is {1}", car.Speed, car.Height);
     car.Speed = 100;
     car.Height = -3.2;
     Console.WriteLine("Speed is {0} and height is {1}", car.Speed, car.Height);
 }
Beispiel #9
0
        static void Main(string[] args)
        {

            //Create new car object
            Car car = new Car();
            car.Speed = 300;
            car.Height = 4.6;
            Console.WriteLine("Speed is {0}", car.Speed);
            Console.WriteLine("Height is {0}", car.Height);
            
            Console.ReadLine();

        }
Beispiel #10
0
        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();
        }
Beispiel #11
0
 private static IVehicle createVehicle(string make, string model, string color, string nickname, string license, int price, int year, string category)
 {
     IVehicle current;
     if (category == "car")
     {
         current = new Car(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }
     else if (category == "truck")
     {
         current = new Truck(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }
     else if (category == "suv")
     {
         current = new SUV(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }
     else if (category == "compactCar")
     {
         current = new CompactCar(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }
     else if (category == "midSizeCar")
     {
         current = new MidSizeCar(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }
     else if (category == "fullSizeCar")
     {
         current = new FullSizeCar(make, model, color, nickname, license, price, year);
         Vehicles.Add(current);
         Console.WriteLine(current.nickname + " added successfully to the lot outside garage.");
         return current;
     }else{
         current = new Car(make, model, color, nickname, license, price, year);
         Console.WriteLine(current.nickname + " was not added because the category specified was not found: " + category);
         return current;
     }
 }