Anda di halaman 1dari 2

super.

onCreate(savedInstanceState);
setContentView(R.layout.activity_hitung);

rgjob = (RadioGroup) findViewById(R.id.rgjob);


rgjk = (RadioGroup) findViewById(R.id.rgjk);
rgstatus = (RadioGroup) findViewById(R.id.rgstatus);

rblk = (RadioButton) findViewById(R.id.rblk);


rbpr = (RadioButton) findViewById(R.id.rbpr);
rbmhs = (RadioButton) findViewById(R.id.rbmhs);
rbjob = (RadioButton) findViewById(R.id.rbkerja);
rblajang = (RadioButton) findViewById(R.id.rbsingle);
rbnikah = (RadioButton) findViewById(R.id.rbnikah);

answer1 = ((RadioButton)
findViewById(rgjk.getCheckedRadioButtonId())).getText().toString();
answer2 = ((RadioButton)
findViewById(rgjob.getCheckedRadioButtonId())).getText().toString();
answer3 = ((RadioButton)
findViewById(rgstatus.getCheckedRadioButtonId())).getText().toString();

etipk= (EditText) findViewById (R.id.etipk);

// hasil = (TextView) findViewById (R.id.tvhasil);


// proses();
}

public void proses() {


if (answer1== "Laki-Laki"){
lktepat=0.625;
lktelat=0.43;
}
else if (answer1=="Perempuan"){
prtepat=0.375;
prtelat=0.57;
}
if (answer2 == "Mahasiswa"){
mhstepat=0.625;
mhstelat=0.43;
}
else if (answer2=="Bekerja"){
kerjatepat=0.375;
kerjatelat=0.57;
}
if (answer3=="Lajang"){
lajangtepat=0.5;
lajangtelat=0.57;
}
else if(answer3=="Menikah"){
nikahtepat=0.5;
nikahtelat=0.43;
}
ipk = Double.parseDouble(etipk.getText().toString());
if (ipk>3){
ipktepat=0.9;
ipktelat=0.1;
}
else if(ipk<3){
ipktepat=0.1;
ipktelat=0.9;
}
// hitung1();
}

private void hitung1() {


statustelat
=lktelat*prtelat*mhstelat*kerjatelat*lajangtelat*nikahtelat*ipktelat;

statustepat=lktepat*prtepat*mhstepat*kerjatepat*lajangtepat*nikahtepat*ipktepat;

if (statustepat>statustelat){
hasil1 = "tepat";
}
else if (statustepat<statustelat){
hasil1 ="telambat";
}
hasil.setText(hasil1);
}

Anda mungkin juga menyukai