static void Main(string[] arguments)
        {
            Odometer odometer = new Odometer(10, 250);

            Console.WriteLine($"Initial reading: {odometer}");

            odometer.Add(3, 60);
            Console.WriteLine($"After using 3 gallons over 60 miles: {odometer.MilesPerGallon()}");

            odometer.ResetMeter();
            Console.WriteLine($"Reset: {odometer}");
        }
示例#2
0
        static void Main(string[] args)
        {
            Odometer trip1 = new Odometer();

            trip1.Add(50, 10);
            Console.WriteLine("fuel used for trip1 is: " + trip1.mpg());
            Odometer trip2 = new Odometer(50, 10);

            trip2.Add(100, 20);
            Console.WriteLine("fuel used for trip2 is: " + trip2.mpg());
            Console.WriteLine(trip1.toString());
            Console.WriteLine(trip2.toString());
            if (trip1.equals(trip1))
            {
                Console.WriteLine("The two object are the same");
            }
            else
            {
                Console.Write("The two objects are NOT the same");
            }
            //toDo : reset
            //ToDo : test toString();
            //test every method
        }