Exemple #1
0
        static void Main(string[] args)
        {
            Car myNewCar = new Car();

            myNewCar.Make = "Toyota";
            myNewCar.Model = "4Runner";
            myNewCar.Year = 2006;
            myNewCar.OriginalPrice = 35000;
            myNewCar.Colour = "White";

            //Car myOtherCar = myNewCar;

            //Console.WriteLine(myOtherCar.Make);

            //myNewCar = null;
            //myOtherCar = null;

            //Console.WriteLine("{0} - {1} - {2}", myNewCar.Make, myNewCar.Model, myNewCar.Colour);

            //determineMarketValue(myNewCar);

            //double myValue = myNewCar.DetermineMarketValue();

            //myNewCar.DetermineMarketValue();
            //Console.WriteLine(myNewCar.CurrentValue.ToString());
            Console.WriteLine("Before: " + myNewCar.Make);
            doByValue(myNewCar);
            Console.WriteLine("After By Value: " + myNewCar.Make);
            doByReference(ref myNewCar);
            Console.WriteLine("After By Reference: " + myNewCar.Make);

            Console.ReadLine();
        }
        private static double determineMarketValue(Car car)
        {
            double carValue = 100.0;

            //Look up car value and return it
            return carValue;
        }
Exemple #3
0
 private static string printCar(Car car)
 {
     return String.Format("{0} - {1} - {2} - {3}",
         car.Make,
         car.Model,
         car.Year,
         car.Color);
 }
Exemple #4
0
        private static void Main(string[] args)
        {
            Car myNewCar = new Car();

              myNewCar.Make = "Oldsmobile";
              myNewCar.Model = "Cutlas Suprime";
              myNewCar.Year = 1986;
              myNewCar.Color = "Silver";
 private static double determineMarketValue(Car _car)
 {
     double carValue = 100.0;
     
     // Somedat white come to go online and look up the car's value
     // and trieve its value into the carValue variable
     return carValue;
 }
Exemple #6
0
        private static double determineMarketValue(Car _car)
        {
            double carValue = 100.0;

            //Someday 
            //
            return carValue;
        }
Exemple #7
0
        private static decimal DetermineMarketValue(Car car)
        {
            decimal carValue = 100.0M;

            // Someday I might look up the car
            // online webservice to get more
            // accurate value.
            return carValue;
        }
        private static double determineMarketValueAsAMethodOutsideTheClass(Car car)
        {
            double carValue = 100.0;

            //Somedat white come to go online and look up the car´s value
            //and trieve its value into the carValue variable

            return carValue;
        }
        static void Main(string[] args)
        {
            Car myNewCar = new Car();
            myNewCar.Make = "Chevrolet";
            myNewCar.Model = "Yukon";
            myNewCar.Year = 2004;
            myNewCar.Colour = "blue";

            //Console.WriteLine("{0} - {1} - {2} :$ {3}", myNewCar.Model, myNewCar.Make, myNewCar.Colour, determineMarketValue(myNewCar));
            Console.WriteLine("{0} - {1} - {2} :$ {3}", myNewCar.Model, myNewCar.Make, myNewCar.Colour, myNewCar.determinePrice());
            //double marketValueOfCar = determineMarketValue(myNewCar);
            Console.ReadLine();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Car myNewCar = new Car();

            myNewCar.Make = "Honda";
            myNewCar.Model = "Civic";
            myNewCar.Year = 1998;
            myNewCar.Color = "red";

            Console.WriteLine("{0} - {1} - [2}", myNewCar.Make, myNewCar.Model, myNewCar.Color);

            Console.WriteLine("Car's value: {0:C}", myNewCar.determineMarketValue());

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Car myCar = new Car();
            myCar.Make = "Slim";
            myCar.Model = "Porsche";
            myCar.Year = 2016;
            myCar.Color = "Blue";

            Console.WriteLine("{0} - {1} - {2} - {3} Color",
                myCar.Make,
                myCar.Model,
                myCar.Year,
                myCar.Color);
            Console.WriteLine("Market Value - {0:C}", myCar.determineMarketValue());
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Car myNewCar = new Car();
            myNewCar.Make = "Oldsmobile";
            myNewCar.Model = "Cutlas Supreme";
            myNewCar.Year = 1986;
            myNewCar.Color = "Silver";

            Console.WriteLine("{0} - {1} - {2}",
                myNewCar.Make,
                myNewCar.Model,
                myNewCar.Color);

            Console.WriteLine("Car's value: {0:C}", myNewCar.DetermineMarketValue());

            Console.ReadLine();
        }
Exemple #13
0
        private static double determineValue(Car car)
        {
            double carValue = 1000.99;

            if (car.Year > 2010)
            {
                carValue = 12500.99;
            }
            else if (car.Year > 2000)
            {
                carValue = 7500.99;
            }
            else if (car.Year > 1990)
            {
                carValue = 2500.99;
            } 
            return carValue;
        }
Exemple #14
0
        static void Main(string[] args)
        {
            Car myNewCar = new Car();

            myNewCar.Make = "Oldsmobile";
            myNewCar.Model = "Cutlas Supreme";
            myNewCar.Year = 1986;
            myNewCar.Color = "Silver";

            myNewCar.Value= myNewCar.DetermineMarketValue(); //setting carvalue with the method

            Console.WriteLine("{0} - {1} - {2} - {3} - {4}",
                myNewCar.Make,
                myNewCar.Model,
                myNewCar.Year,
                myNewCar.Color,
                myNewCar.Value);

            Console.ReadLine();
        }
Exemple #15
0
        static void Main(string[] args)
        {
            Car myCar = new Car();
            myCar.Make = "BMW";
            myCar.Model = "330Ci";
            myCar.Color = "Black";
            myCar.Year = 2008;

            Console.WriteLine(printCar(myCar));
            Console.WriteLine("Wert des Fahrzeugs: "+ determineValue(myCar));
            
            Console.ReadLine();

            Car mySecondCar = new Car("Porsche", "Cayman", 2011, "Racing Red");
            Console.WriteLine(printCar(mySecondCar));
            
            Console.WriteLine("Wert des Fahrzeugs: {0:C}", mySecondCar.DetermineCarValue());

            Console.ReadLine();
        }
 static void Main(string[] args)
 {
     Car myNewCar = new Car();
     myNewCar.Model = "Cutlas Supreme";
     myNewCar.Color = "Blue";
     myNewCar.Year = 1990;
     myNewCar.Make = "OldsMobile";
     
     //Console.WriteLine(myNewCar.Color + "\n" + myNewCar.Model);
     Console.WriteLine("{0} - {1} - {2} - {3}",
                         myNewCar.Make,
                         myNewCar.Model,
                         myNewCar.Year,
                         myNewCar.Color);
     
     //double marketValueOfCar = determineMarketValue(myNewCar);
    
     Console.WriteLine("Car's Value: {0:C}", myNewCar.determineMarketValue());
     
     Console.Read();
 }
Exemple #17
0
        static void Main(string[] args)
        {
            Car myCar = new Car();
            myCar.Make = "Oldsmobile";
            myCar.Model = "Cutlas Supreme";
            myCar.Year = 1986;
            myCar.Color = "Silver";

            Console.WriteLine("{0} {1} {2} {3}",
                myCar.Make,
                myCar.Model,
                myCar.Year,
                myCar.Color);

            //decimal value = DetermineMarketValue(myCar);
            //Console.WriteLine("{0:C}", value);

            Console.WriteLine("{0:C}", myCar.DetermineMarketValue());

            Console.ReadLine();
        }
Exemple #18
0
 private static void doByReference(ref Car car)
 {
     car = new Car();
     car.Make = "BMW";
 }
Exemple #19
0
        private static double determineMarketValue(Car car)
        {
            double carValue = 100.00;

            return carValue;
        }
Exemple #20
0
 //private static double determineMarketValue(Car car)
 //{
 //    return 100.0;
 //}
 private static void doByValue(Car car)
 {
     car = new Car();
     car.Make = "BMW";
 }
Exemple #21
0
 private static double determineMarketValue(Car car)
 {
     return 100.0;
 }