Making android app -- HELP [message #988723] |
Sun, 02 December 2012 04:47 |
Andrew Perez Messages: 1 Registered: December 2012 |
Junior Member |
|
|
Hey guys, new to eclipse, I'm making an android app that calculates the percentage in a simple equiation. Is basically a survey where you input the to total amount of answers (OSAT), the amount of possitive responses (Promoters), The people the felt avarage (Passives), and the people that felt bad (Detractors).
My equation so far goes (promoters-detractors)/osat, passives are not taken in count to calculate total, and this is my coding and how everything is looking right now.
public void calculate(View v){
EditText tosattext=(EditText)findViewById(R.id.osattext);
EditText promoterstext=(EditText)findViewById(R.id.promtext);
EditText passivestext=(EditText)findViewById(R.id.passtext);
EditText detractorstext=(EditText)findViewById(R.id.dettext);
Integer osat=Integer.parseInt(tosattext.getText().toString()),prom=Integer.parseInt(promoterstext.getText().toString()),pass=Integer.parseInt(passivestext.getText().toString()),det=Integer.parseInt(detractorstext.getText().toString());
Integer nps=(prom-det)/osat;
TextView npst=(TextView)findViewById(R.id.npstext);
npst.setText("NPS Total: "+nps.toString());
}
The calculation works, problem is that right now the result its shown as "0" because the result is always going to be "0.60" or some decimels. So the idea is for the total to show the result in percentage, ex.
OSAT= 129
promoters= 95
passive= 9 (not use for total, but still need to input in form)
detractors= 20
NPSTotal=(95-20)/129 , NPSTotal= 60%
Appreciate all the help, i'm sure this is would be cake for anybody with experience on eclipse. Thanks in advance.
|
|
|
|
Powered by
FUDForum. Page generated in 0.07694 seconds