c# - Console outputting too many results -


i want receive 1 value as_x, written in console, 2 values, 1 wrong "infinity", "not defined" or strange value. "pressure" contains 3 shown "enum" values. want calculate as_x @ end. therefore, depending on lookupvaluemux, value omega. , depending on value of omega there 3 different ways calculate as_x. real beginner in programming, great.

double omega; double as_x; pressure design; double m_eds_lim = 0.296 * math.pow(d, 2) * (fck * design_force.alpha_cc / design_force.gamma_c); double delta_m_ed = mx - m_eds_lim;  omega = 0; design = 0; as_x = 0;  double mux = mx / (math.pow(d, 2) * (fck * design_force.alpha_cc / design_force.gamma_c)); double lookupvaluemux = math.round(mux, 2);   if (lookupvaluemux < 0.01) {     design = pressure.min; } else if ((lookupvaluemux >= 0.01) && (lookupvaluemux < 0.30))  {     design = pressure.tension;     omega = design_force.omegatable[lookupvaluemux][0]; } else if (lookupvaluemux >= 0.30); {     design = pressure.steel;     omega = 0.3643; };  if (design == pressure.min) {     as_x = as_min;     console.writeline("asx id " + id + "asx  =  " + as_x); } else if (design == pressure.tension) {     as_x = omega * d * (fck * design_force.alpha_cc / design_force.gamma_c) / (f_yk / design_force.gamma_s);     console.writeline("asx id " + id + "asx  =  " + as_x); } else if (design == pressure.steel); {      as_x = omega * d * (fck * design_force.alpha_cc / design_force.gamma_c) / (f_yk / design_force.gamma_s) + delta_m_ed / (d - d_2) / (f_yk / design_force.gamma_s);     console.writeline("asx id " + id + "asx  =  " + as_x); } 

in unedited original post, line had spurious semicolon @ end:

else if (design == pressure.steel); 

this has been edited away other op (not dasblinkenlight either), semicolon no longer there in question.

since causing as_x printed twice, unhelpful edited out.

note there superfluous semicolon remaining in line:

} else if (lookupvaluemux >= 0.30); { 

which should removed.

this how second half of original post appeared:

if (design == pressure.min) { as_x = as_min; console.writeline("asx id " + id + "asx  =  " + as_x); } else if (design == pressure.tension) { as_x = omega * d * (fck * design_force.alpha_cc / design_force.gamma_c) / (f_yk / design_force.gamma_s); console.writeline("asx id " + id + "asx  =  " + as_x); }  else if (design == pressure.steel); // <---- lookie here  {  as_x = omega * d * (fck * design_force.alpha_cc / design_force.gamma_c) / (f_yk / design_force.gamma_s) + delta_m_ed / (d - d_2) / (f_yk / design_force.gamma_s); console.writeline("asx id " + id + "asx  =  " + as_x); } 

Comments