Skip to content

Instantly share code, notes, and snippets.

@jwynia
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save jwynia/dd85514cf7604f70e18b to your computer and use it in GitHub Desktop.

Select an option

Save jwynia/dd85514cf7604f70e18b to your computer and use it in GitHub Desktop.
Extended Driving Commute Formula
//Sample rate of $75 for demonstration purposes.
var rate = 75;
var nominalDayHours= 8;
var driveTimeEachWay = 62;
var allowedTimeEachWay = 30;
//2015 IRS rate of $0.575 per mile
decimal irsMileage = 0.575M;
decimal overage = (driveTimeEachWay - allowedTimeEachWay) * 2;
decimal mileageAdjustment = overage * irsMileage;
decimal fractionOfHour = overage/60;
var drivingDollars = rate * fractionOfHour;
var adjustedDollars = (rate * nominalDayHours) + drivingDollars + mileageAdjustment;
var adjustedRate = adjustedDollars / nominalDayHours;
Console.WriteLine(Math.Round(adjustedRate));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment