Android - aplicacion que necesita dar resultados

 
Vista:

aplicacion que necesita dar resultados

Publicado por Carlos (1 intervención) el 10/06/2020 22:04:59
Muy buenas, soy nuevo en todo esto, estoy usando Android Studio para la realización de un calculo estoy usando condicionantes, para que depende el proceso me de un resultado, por ejemplo si este numero es menor a este mostrar este resultado, si es mayor a este mostrar sumar 10 y realizar este proceso, el problema es que al momento de ejecutar a todo me suma 10 y no me acepta las condicionantes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.example.arquitectura;
 
import androidx.appcompat.app.AppCompatActivity;
 
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
 
public class DecimaActivity extends AppCompatActivity {
    private EditText n1;
    private EditText n2;
    private EditText n3;
    private EditText n4;
    private EditText n5;
    private TextView tv1;
    private TextView tv2;
    private TextView tv3;
    private TextView tv4;
    private TextView tv5;
    private TextView tv6;
 
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_decima);
        n1 = (EditText) findViewById(R.id.bc);
        n2 = (EditText) findViewById(R.id.ac);
        n3 = (EditText) findViewById(R.id.az);
        n4 = (EditText) findViewById(R.id.ht);
        n5 = (EditText) findViewById(R.id.dv);
        tv1 = (TextView) findViewById(R.id.Resultado15);
        tv2 = (TextView) findViewById(R.id.Resultado16);
        tv3 = (TextView) findViewById(R.id.Resultado17);
        tv4= (TextView) findViewById(R.id.Resultado18);
        tv5= (TextView) findViewById(R.id.Resultado19);
        tv6= (TextView) findViewById(R.id.Resultado20);
    }
    //Este metodo realiza la suma
    public void Raiz (View view){
        String valor1 = n1.getText().toString();
        String valor2 = n2.getText().toString();
        String valor3 = n3.getText().toString();
        String valor4 = n4.getText().toString();
        String valor5 = n5.getText().toString();
 
        double num1 = Double.parseDouble(valor1);
        double num2 = Double.parseDouble(valor2);
        double num3 = Double.parseDouble(valor3);
        double num4 = Double.parseDouble(valor4);
        double num5 = Double.parseDouble(valor5);
        double num6 = 0.85;
        double num7 = 0.9;
        double doce = 1.13;
        double por = 15;
        double catorce = 1.54;
        double dseis = 2.01;
        double docho = 2.54;
        double veinte= 3.14;
        double vdos = 3.80;
        double vcinco = 4.91;
        double pb = 20;
        double pba = 0;
 
 
 
 
        double area = ((num1-5)*(num2-5));
        double multiplicacion = (((area)*0.01)+0.1);
        double fc = (0.225*210);
        double fs = (10-1)*fc+600;
        double peso = (((area*fc)+(multiplicacion*fs))/1000);
 
        // calculo de zapata
 
 
        double af = (peso+(por/100)*peso)/20;
        double raizaf = Math.sqrt(af);
 
        raizaf = Math.round(raizaf * 100);
        raizaf = raizaf/100;
        raizaf = 0.05*(Math.ceil(Math.abs(raizaf/0.05)));
 
 
        double afa = raizaf*raizaf;
        double w = afa*num4*2.16;
        double pbs = (peso+w)/afa;
 
 
       if(20 > pbs){
 
            String result = String.valueOf(pbs);
            tv1.setText(result);
            String result0 = String.valueOf(raizaf);
            tv2.setText(result0);
        }
 
        if(20 < pbs){
 
            double raizaf1 = (raizaf+0.1);
            double afa1 = (raizaf1*raizaf1);
            double w1 = afa1*num4*2.16;
            double pbs1 = (peso+w1)/afa1;
 
            if(20 > pbs1){
 
            String result = String.valueOf(pbs1);
            tv1.setText(result);
            String result0 = String.valueOf(raizaf1);
            tv2.setText(result0);
 
        }else{
                if(20 < pbs1){
                    double raizaf2 = (raizaf+0.15);
                    double afa2 = (raizaf2*raizaf2);
                    double w2 = afa2*num4*2.16;
                    double pbs2= (peso+w2)/afa2;
 
                    if(20 > pbs2){
                        String result = String.valueOf(pbs1);
                        tv1.setText(result);
                        String result0 = String.valueOf(raizaf1);
                        tv2.setText(result0);
                    }
                }
            }
        }
    }
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder