{"size": 485, "ext": "js", "max_stars_repo_path": "src/makeChange.js", "max_stars_repo_name": "thisisrai/SANDBOX_REPO", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/makeChange.js", "max_issues_repo_name": "thisisrai/SANDBOX_REPO", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/makeChange.js", "max_forks_repo_name": "thisisrai/SANDBOX_REPO", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.1666666667, "max_line_length": 58, "alphanum_fraction": 0.5690721649}
export default function makeChange({price, amountGiven}) {

  if(amountGiven < price) {
    return "INSUFFICIENT FUND";
  }
  let change = amountGiven - price;
  let coins = {
    quarters: 0,
    dimes: 0,
    nickels: 0,
    pennies: 0
  }

  while(change > 25){
    coins.quarters ++;
    change -= 25;
  }
  while(change >= 10){
    coins.dimes ++;
    change -= 10;
  }
  while(change >= 5){
    coins.nickels ++;
    change -= 5;
  }
  coins.pennies = change;

  return coins;
}
