Death Note Ost

Download Original Soundtrack Anime : DEATH NOTE di sini :)

This is default featured slide 2 title

Download dan browsing di sini ya :)

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Sunday 6 November 2016

Java Android Konversi Suhu

Berikut ini merupakan script aplikasi konversi suhu pada java android


package com.example.annisatuz.suhulaage;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    Spinner sp;
    String[] list = {"C", "R", "F", "K"};
    EditText input;
    TextView textView, textView2, textView3, textView4;
    Button button;
    double awal, c, r, f, k;
    ArrayAdapter<String> adapter;

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

        sp = (Spinner)findViewById(R.id.spinner);
        input = (EditText)findViewById(R.id.editText);
        textView = (TextView)findViewById(R.id.textView);
        textView2 = (TextView)findViewById(R.id.textView2);
        textView3 = (TextView)findViewById(R.id.textView3);
        textView4 = (TextView)findViewById(R.id.textView4);

        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
        sp.setAdapter(adapter);

        button = (Button)findViewById(R.id.button);
        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        try{
            hitung();
        }catch (NumberFormatException  e){
            Toast.makeText(MainActivity.this, "Masukkan Angka Saja", Toast.LENGTH_SHORT).show();
        }
    }

    public void hitung(){
        String satuan = String.valueOf(sp.getSelectedItem());
        awal = Double.parseDouble(input.getText().toString());
        if (satuan=="C"){
            c = awal;
            r = c*4/5;
            f = (c*9/5)+32;
            k = c+273;

            textView.setText("Celcius : " + String.valueOf(c));
            textView2.setText("Reamur : " + String.valueOf(r));
            textView3.setText("Fahrenheit : " + String.valueOf(f));
            textView4.setText("Kelvin : " + String.valueOf(k));

        } else if(satuan=="R"){
            r = awal;
            c = r*5/4;
            f = (c*9/5)+32;
            k = c+273;

            textView.setText(String.valueOf(c));
            textView2.setText(String.valueOf(r));
            textView3.setText(String.valueOf(f));
            textView4.setText(String.valueOf(k));
        } else if(satuan=="F"){
            f = awal;
            c = (f-32)*5/9;
            r = c*4/5;
            k = c+273;

            textView.setText(String.valueOf(c));
            textView2.setText(String.valueOf(r));
            textView3.setText(String.valueOf(f));
            textView4.setText(String.valueOf(k));
        } else if(satuan=="K"){
            k = awal;
            c = k-273;
            r = c*4/5;
            f = (c*9/5)+32;

            textView.setText(String.valueOf(c));
            textView2.setText(String.valueOf(r));
            textView3.setText(String.valueOf(f));
            textView4.setText(String.valueOf(k));
        }

    }
}