Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. private void BreakEvenCalculation()
  2. {
  3. var purchaseprice = Decimal.Parse(PurchasePriceEntry.Text);
  4. var purchaseweight = Decimal.Parse(PurchaseWeightEntry.Text);
  5. var purchasefreight = Decimal.Parse(PurchaseFreightEntry.Text);
  6. var medicineimplants = Decimal.Parse(MedicineImplantsEntry.Text);
  7. var costofgain = Decimal.Parse(CostOfGainEntry.Text);
  8. var poundstillsell = Decimal.Parse(PoundsTillSellEntry.Text);
  9. var deathloss = Decimal.Parse(DeathLossEntry.Text);
  10. var saleweight = Decimal.Parse(SaleWeightEntry.Text);
  11. var salefreight = Decimal.Parse(SaleFreightEntry.Text);
  12. var breakeven = Decimal.Parse(BreakEvenEntry.Text);
  13.  
  14.  
  15. var purchasedollars = purchaseprice * purchaseweight;
  16. var feedcost = costofgain * poundstillsell;
  17. poundstillsell = saleweight - purchaseweight;
  18.  
  19.  
  20. var costs = (purchasedollars + purchasefreight + medicineimplants + feedcost + deathloss + salefreight);
  21. breakeven = costs / saleweight; //throws exception.... System.DivideByZeroException: Attempted to divide by zero
  22. //breakeven = costs / (saleweight + 1); //correctly equals 1.111302549965541
  23. //breakeven = costs * saleweight; //correctly equals 2338125.00
  24. //breakeven = saleweight; //correctly equals 1450.00
  25. //breakeven = costs; //correctly equals 1612.50
  26. ////////////breakeven should equal 1.112068965517241
  27. BreakEvenEntry.Text = breakeven.ToString();
  28. }
  29.  
  30. breakeven = costs / saleweight;
  31.  
  32. breakeven = saleweight;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement