Tugas UAS Mobile Programming Menghitung Gaji Karyawan

Nama : Gilang Nugraha
Nim   : 161021401449
Kelas : 06TPLE003

1.Deskripsi
Aplikasi Menghitung gaji karyawan sangat bermanfaat untuk kebutuhan penggajian hanya dengan bermodalkan smartphone kini dapat menghitung gaji karyawan dengan akurat dan efisien
2. ActivityMain.xml
ACTIVITY_MAIN.XML 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/inputnama" />
<EditText
android:id = "@+id/nama"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:hint="@string/nama" />
<TextView
android:layout_marginTop = "15dp"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jk" />
<CheckBox
android:id="@+id/laki"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/laki" />
<CheckBox
android:id = "@+id/perem"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/perem" />
<TextView
android:layout_marginTop = "15dp"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jm"/>
<RadioGroup
android:id = "@+id/rgGolongan"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content" >
<RadioButton
android:id = "@+id/rbGolongan1"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jm1" />
<RadioButton
android:id = "@+id/rbGolongan2"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jm2" />
<RadioButton
android:id = "@+id/rbGolongan3"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jm3"/>
<RadioButton
android:id = "@+id/rbGolongan4"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:text = "@string/jm4"/>
<Button
android:layout_width="182dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:onClick="hitung"
android:text="@string/hj" />
</RadioGroup>
<TextView
android:id = "@+id/outputNama"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:gravity = "center"
android:textSize = "20sp"
android:text = "" />
<TextView
android:id = "@+id/outputGaji"
android:layout_width = "fill_parent"
android:layout_height= "wrap_content"
android:gravity = "center"
android:textSize = "35sp"
android:text = "" />
</LinearLayout>


3.MainActivityJava


MAIN ACTIVITY.JAVA 

package example.htg;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
int gajiST, gajiPerJam;
RadioButton jm1, jm2, jm3, jm4;
RadioGroup JamKerjaLembur;
Button hitung;
CheckBox jeke;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void hitung(View v) {
EditText nama = (EditText) findViewById(R.id.nama);
TextView outputNama = (TextView) findViewById(R.id.outputNama);
String name = nama.getText().toString();
outputNama.setText("Total Gaji " + name);
jeke = (CheckBox) findViewById(R.id.laki);
if (jeke.isChecked()) {
gajiST = 1500000;
}
;
JamKerjaLembur = (RadioGroup) findViewById(R.id.rgGolongan);
int jm = JamKerjaLembur.getCheckedRadioButtonId();
if (jm == R.id.rbGolongan1) {
gajiPerJam = 7000;
} else if (jm == R.id.rbGolongan2) {
gajiPerJam = 14000;
} else if (jm == R.id.rbGolongan3){
gajiPerJam = 21000;
} else if (jm == R.id.rbGolongan4){
gajiPerJam = 28000;
}
;
int totalGaji = gajiST + gajiPerJam;
TextView total = (TextView) findViewById(R.id.outputGaji);
total.setText(String.valueOf(totalGaji));



4. strings.xml

STRING.XML

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">HitungGajiLembur</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="inputnama">Masukan Nama Anda :</string>
<string name="nama">Nama Anda</string>
<string name="jk">Jenis Kelamin</string>
<string name="laki">Laki-laki</string>
<string name="perem">Perempuan</string>
<string name="hj">Hasil Gaji Lembur</string>
<string name="jm">Jam Kerja Lembur</string>
<string name="jm1">1 jam kerja</string>
<string name="jm2">2 jam kerja</string>
<string name="jm3">3 jam kerja</string>
<string name="jm4">4 jam kerja</string>
</resources>



5. Kemudian Jalankan Programmnya

6. Hasil

Komentar

Posting Komentar

Postingan populer dari blog ini

program billing hotel sederhana

Anti Aliasing