code_junkie

C#, If Statement, Min and Max

Nov 13th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. A = .8-(Y/3)/10.0;
  2.  
  3. int Holder = Y, A=.8;
  4. while (Holder > 0)
  5. {
  6. A-= .1;
  7. Holder-= 3;
  8. }
  9.  
  10. If Y<3
  11. A=.8
  12. Else if Y < 6
  13. A=.7
  14. Else if Y < 9
  15. A=.6
  16.  
  17. if(Y <= 3.0) A = ...;
  18. else if(Y <= 6.0) A = 0.7;
  19. else if(Y <= 9.0) A = 0.6;
  20. ...
  21.  
  22. int temp = Y / 3;
  23. float A = 0.8f - (temp / 10f);
  24.  
  25. if ((cb5_1.Checked)&&(cb5_2.Checked)&&(cb5_3.Checked))
  26. {//if the first three text boxes are checked calculate based on the following.
  27. decimal a, b, c, z;
  28. decimal aa, bb, cc, zz;
  29. a = decimal.Parse(cbx5_1a.Text);
  30. b = decimal.Parse(cbx5_2a.Text);
  31. c = decimal.Parse(cbx5_3a.Text);
  32. aa = decimal.Parse(cbx5_1q.Text);
  33. bb = decimal.Parse(cbx5_2q.Text);
  34. cc = decimal.Parse(cbx5_3q.Text);
  35. z = (aa+bb+cc);
  36.  
  37. if (z = > 3)
  38. {
  39. zz = ((a*aa)+(b*bb)+(c*cc))*.7m;
  40. }
  41. else if (z = > 6)
  42. {
  43. zz = ((a*aa)+(b*bb)+(c*cc))*.6m;
  44. }
  45. else if(z = > 9)
  46. {
  47. zz = ((a*aa)+(b*bb)+(c*cc))*.5m;
  48. }
  49. tb5_atotal.Text = Math.Round(z,2).ToString();
  50.  
  51. if ((cb5_1.Checked)&&(cb5_2.Checked)&&(cb5_3.Checked))
  52. {
  53. //if the first three text boxes are checked calculate based on the following.
  54. decimal a, b, c, d, z;
  55. decimal aa, bb, cc, zz;
  56. a = decimal.Parse(cbx5_1a.Text);
  57. b = decimal.Parse(cbx5_2a.Text);
  58. c = decimal.Parse(cbx5_3a.Text);
  59. aa = decimal.Parse(cbx5_1q.Text);
  60. bb = decimal.Parse(cbx5_2q.Text);
  61. cc = decimal.Parse(cbx5_3q.Text);
  62. z = (aa+bb+cc);
  63.  
  64. d = 0.8m - ((z / 3) / 10m);
  65.  
  66. zz = ((a*aa)+(b*bb)+(c*cc))*d;
  67.  
  68. tb5_atotal.Text = Math.Round(z,2).ToString();
  69.  
  70. if Y <= maxValue then
  71. if Y >= minValue then
  72. return value
  73. else
  74. follow minLink
  75. else
  76. follow maxLink
Add Comment
Please, Sign In to add comment