Skip to content

Instantly share code, notes, and snippets.

@SalesforceBobLightning
Created February 14, 2019 13:50
Show Gist options
  • Save SalesforceBobLightning/998da53bc148a7de8b564c77076246e1 to your computer and use it in GitHub Desktop.
Save SalesforceBobLightning/998da53bc148a7de8b564c77076246e1 to your computer and use it in GitHub Desktop.
Salesforce Apex Weight Converter
public class WeightConverter {
private static final Decimal KILOGRAMS_TO_POUNDS_RATIO = 2.205;
public static Decimal kilogramsToPounds(Decimal kilograms) {
return kilograms * KILOGRAMS_TO_POUNDS_RATIO;
}
public static Decimal poundsToKilograms(Decimal pounds) {
return pounds / KILOGRAMS_TO_POUNDS_RATIO;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment