0% found this document useful (0 votes)
57 views4 pages

Laporan Praktikum Pemrograman Android Event Klik (Irgie Bramadhan 5CB)

Uploaded by

Irgie Bramadhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views4 pages

Laporan Praktikum Pemrograman Android Event Klik (Irgie Bramadhan 5CB)

Uploaded by

Irgie Bramadhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Nama : Irgie Bramadhan

Kelas : 5 CB

NIM : 061830700501

LAPORAN PRAKTIKUM PEMROGRAMAN ANDROID

EVENT KLIK

1. Coding MainActivity.Java

package com.example.gaji;

import android.os.Bundle;
import android.widget.EditText;
import android.widget.Button;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {

private EditText nip,nama_pegawai,gajipkk,tnjngn,ptngan,gajibersih;


private Button tmbh;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

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


nama_pegawai = (EditText) findViewById(R.id.nama_pegawai);
gajipkk = (EditText) findViewById(R.id.gajipkk);
tnjngn = (EditText) findViewById(R.id.tnjngn);
ptngan = (EditText) findViewById(R.id.ptngan);
gajibersih = (EditText) findViewById(R.id.gajibersih);
tmbh = (Button) findViewById(R.id.tmbh);

public void hitunggajibersih(View v) {


int gpokok = Integer.parseInt(gajipkk.getText().toString());
int tunjangan = Integer.parseInt(tnjngn.getText().toString());
int potongan = Integer.parseInt(ptngan.getText().toString());
int hsl = 0;

hsl = gpokok+tunjangan-potongan;
String hasilstring = String.valueOf(hsl);

gajibersih.setText(hasilstring);
}
}

2. Coding activity_main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="15dp"
android:orientation="vertical"
tools:ignore="ExtraText">

<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="46dp"
android:textAlignment="center"
android:text="MENGHITUNG GAJI BERSIH KARYAWAN" />

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NIP" />

<EditText
android:id="@+id/nip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />

<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NAMA PEGAWAI" />

<EditText
android:id="@+id/nama_pegawai"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />

<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="GAJI POKOK" />

<EditText
android:id="@+id/gajipkk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />

<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TUNJANGAN" />

<EditText
android:id="@+id/tnjngn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />

<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="POTONGAN" />

<EditText
android:id="@+id/ptngan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />

<Button
android:id="@+id/tmbh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="hitunggajibersih"
android:text="Hitung Gaji Bersih" />

<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="GAJI BERSIH" />

<EditText
android:id="@+id/gajibersih"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />

</LinearLayout>

3. Hasil Screenshot Running Program

You might also like