I am trying to get water flow with this formula but when I run my app I get 64.52 and I should get 92.71. If I run the same formula in vb.net it works fine. Can sum one please take a look and see what I'm not doing right.
P.S. I'm just starting to learn Android.
Thanks.
Android Code
public void buttonOnClick6(View v) {
try {
double B1 = 4
double Y1 = 3
double Z1 = 2
double N1 = 0.012
double S1 = 0.0003
double A1 = (B1 * Y1) + Z1 * pow(Y1, 2);
double P1 = B1 + (2 * Y1) * pow((1 + pow(Z1, 2)), 0.5);
double R1 = A1 / P1;
double CFS = ((1.49 / N1) * A1 * pow(R1, (2/3)) * pow(S1, 0.5));
double SEC1 = (CFS / A1);
TextView textElement3 = (TextView) findViewById(R.id.tb006);
textElement3.setText("Cross-Sect. Area, A = " + String.format("%.2f",A1));
TextView textElement4 = (TextView) findViewById(R.id.tb007);
textElement4.setText("Wetted Perimeter, P = " + String.format("%.2f",P1));
TextView textElement5 = (TextView) findViewById(R.id.tb008);
textElement5.setText("Hydraulic Radius, R = " + String.format("%.2f",R1));
TextView textElement1 = (TextView) findViewById(R.id.tbCFS1);
textElement1.setText("CFS: " + String.format("%.2f",CFS));
TextView textElement2 = (TextView) findViewById(R.id.tbSEC1);
textElement2.setText("FT/SEC: " + String.format("%.3f",SEC1));
} catch (Exception e) {
e.printStackTrace();
}
}
VB.NET Code this work fine
Dim tbB1 As Double = 4
Dim tbY1 As Double = 3
Dim tbZ1 As Double = 2
Dim tbN1 As Double = 0.012
Dim tbS1 As Double = 0.0003
Dim A1 As Double = (tbB1 * tbY1) + tbZ1 * Pow(tbY1, 2)
Dim P1 As Double = tbB1 + (2 * tbY1) * Pow((1 + Pow(tbZ1, 2)), 0.5)
Dim R1 As Double = A1 / P1
Dim CFS1 As Double = (1.49 / tbN1) * A1 * Pow(R1, (2 / 3)) * Pow(tbS1, 0.5)
Dim FT_SEC1 As Double = CFS1 / A1
lbA.Content = "Cross-Sect. Area, A = " & A1
lbP.Content = "Wetted Perimeter, P = " & P1
lbR.Content = "Hydraulic Radius, R = " & R1
lbCFS.Content = "CFS: " & CFS1
lbFTSEC.Content = "FT/SEC: " & FT_SEC1