Advertisement
shady_obeyd

Car.cs

Feb 15th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. public class Car
  2. {
  3.     public string Model { get; set; }
  4.     public decimal FuelAmount { get; set; }
  5.     public decimal FuelConsumptionPerKm { get; set; }
  6.     public decimal DistanceTraveled { get; set; }
  7.  
  8.     public bool CanTravel(decimal desiredDistance, decimal fuelAmount, decimal fuelConsumptionPerKm, decimal distanceTraveled)
  9.     {
  10.         if ((desiredDistance * fuelConsumptionPerKm) <= fuelAmount)
  11.         {
  12.             return true;
  13.         }
  14.         return false;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement