Example #1
0
        public string Drive(double distance)
        {
            var fuelForDistance = VehicleFunctional.DriveVehicle(distance, this.LitersPerKilometer);
            var type            = this.GetType().Name;

            if (fuelForDistance > this.FuelQuantity)
            {
                return($"{type} needs refueling");
            }
            else
            {
                this.FuelQuantity = this.FuelQuantity - fuelForDistance;
                return($"{type} travelled {distance} km");
            }
        }
Example #2
0
 public Vehicle(double fuelQuantity, double litersPerKilometer, double tankCapacity)
 {
     this.FuelQuantity       = VehicleFunctional.CheckTheInitialQuantity(fuelQuantity, tankCapacity);
     this.LitersPerKilometer = litersPerKilometer;
     this.TankCapacity       = tankCapacity;
 }