public class TT extends AppCompatActivity implements View.OnClickListener {
TabHost tabHost;
// 터보cop
EditText chf, c1, che, chl, cof, c2, coe, col, volt, currant, root, powerfactor ;
TextView kcal, hb, coptt, k860, t100, k3024, chresult, coresult, wresult, rt, eff ;
Button inp, inkcal, chk, cok, hbb, coptb, rtb, efficiency ;
// abs cop
EditText chfa, c1a, chea, chla, cofa, c2a, coea, cola, hf, cf, gasin ;
TextView g104, hfm, cfm, hba, copa, usrta, gask, coaresult, charesult ;
Button hfb, cfb, usrtab, copab, hbab, inpa, coab, chab ;
// 농도
EditText lowg, condr, highg, lgcr, abs, eva, a280, a273, a139, a102 ;
TextView lowresult, highresult, absq, total ;
Button lgb, highb, absb, totalb ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tt);
tabHost = (TabHost) findViewById(R.id.tabHost);
tabHost.setup();
tabHost.addTab(tabHost.newTabSpec("").setContent(R.id.tab1).setIndicator("T/cop"));
tabHost.addTab(tabHost.newTabSpec("").setContent(R.id.tab2).setIndicator("A/cop"));
tabHost.addTab(tabHost.newTabSpec("").setContent(R.id.tab3).setIndicator("농도"));
tabHost.addTab(tabHost.newTabSpec("").setContent(R.id.tab4).setIndicator("Gas"));
tabHost.addTab(tabHost.newTabSpec("").setContent(R.id.tab5).setIndicator("Flow"));
}
public void onClick(View v) {
switch (v.getId()) {
// 터보 냉수 열량
case R.id.chk:
String chflowt = chf.getText().toString();
String c1t = c1.getText().toString();
String chet = che.getText().toString();
String chlt = chl.getText().toString();
if (chflowt.length() <= 0 || chet.length() <= 0 || chlt.length() <= 0) {
chresult.setText("조건입력");
chf.setText(null);
che.setText(null);
chl.setText(null);
}
double chk = Double.parseDouble(chflowt) * Double.parseDouble(c1t) * (Double.parseDouble(chet) - Double.parseDouble(chlt));
chresult.setText(String.format(" %,6.0f kcal", chk));
break;
// abs 냉수열량
case R.id.chab:
String c11 = chfa.getText().toString();
String c22 = c1a.getText().toString();
String c33 = chea.getText().toString();
String c44 = chla.getText().toString();
if (c11.length() <= 0 || c33.length() <= 0 || c44.length() <= 0)
{
charesult.setText("조건입력");
chfa.setText(null);
chea.setText(null);
chla.setText(null);
}
double chab = Double.parseDouble(c11) * Double.parseDouble(c22) * (Double.parseDouble(c33) - Double.parseDouble(c44));
chresult.setText(String.format(" %,6.0f kcal", chab));
break;
// 농도
case R.id.lgb:
String lowg1 = lowg.getText().toString();
String condr1 = condr.getText().toString();
String a28 = a280.getText().toString();
String a27 = a273.getText().toString();
String a13 = a139.getText().toString();
String a10 = a102.getText().toString();
if (lowg1.length() <= 0 || condr1.length() <= 0)
{
lowresult.setText("온도입력");
lowg.setText(null);
condr.setText(null);
}
double lgb = (((Double.parseDouble(lowg1) + Double.parseDouble(a28)) / (Double.parseDouble(condr1) + Double.parseDouble(a27))) * Double.parseDouble(a13)) - Double.parseDouble(a10) ;
lowresult.setText(String.format(" %,6.2f %", lgb));
break;
}
}
}
// tab1의 출력은 잘되는데
// tab2의 출력은 되지않아서요...
// tab3 또한 마찬가지입니다... 무지한 사람 살려주세여...
내용이 너무 많아 내용을 조금 짤라냈어요