Showing posts with label Pemograman dan Website. Show all posts
Showing posts with label Pemograman dan Website. Show all posts

Friday, 3 February 2017

Aplikasi Menghitung Volume dengan menggunakan Eclips (Android)

 

Berikut coding Java
package com.example.hitungzega;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.app.Activity;

public class MainActivity extends Activity {
                EditText xsisi,xvolume;
                int xSISI, xVOLUME;
               
                @Override
                protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                                setContentView(R.layout.activity_main);
                }

                public void myClickHandler(View view){
                                switch (view.getId()){
                                case R.id.btnhitung:
                                                xsisi=(EditText)findViewById(R.id.eSisi);
                                                xvolume=(EditText)findViewById(R.id.eVolume);
                                                xSISI=Integer.parseInt(xsisi.getText().toString());
                                                xVOLUME=xSISI*xSISI*xSISI;
                                                xvolume.setText(xVOLUME+"");
                                                break;
                                }
                }
}