TUGAS 01 SISTEM BERKAS -Organisasi Berkas pada Magnetic Tape-
APLIKASI MENGHITUNG
PANJANG PITA - LAMA AKSES - TRANSFER RATE
PADA MAGNETIC TAPE BERBASIS ANDROID
Kelas A
Download APK
Buat yang mau belajar, berikut cuplikan source code nya :- MainActivity.java
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//UNTUK MENAMPILKAN TOMBOL METODE
Button hBloking = (Button)findViewById(R.id.btnBlocking);
Button hTBloking = (Button)findViewById(R.id.btnTBlocking);
//SCRIPT TOMBOL METODE BLOCKING SAAT DI KLIK
hBloking.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, MBlocking.class);
i.putExtra("pesan", "From Activity Main");
startActivity(i);
}
});
//SCRIPT TOMBOL METODE TANPA BLOCKING SAAT DI KLIK
hTBloking.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(MainActivity.this, MTBlocking.class);
i.putExtra("pesan", "From Activity Main");
startActivity(i);
}
});
}
}
- MBlocking.java
public class MBlocking extends ActionBarActivity {
EditText jRecord,pRecord,IBG,bFactor,dDencity,lPita,pPita,lAkses,tRate;
Button btnHBlocking,btnResetBlocking;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mblocking);
initUI();
initEvent1();
initEvent2();
}
private void initUI(){
//UNTUK MEMBACA INPUTAN DATA DAN TOMBOL HITUNG
jRecord = (EditText) findViewById(R.id.jRecord);
pRecord = (EditText) findViewById(R.id.pRecord);
IBG = (EditText) findViewById(R.id.IBG);
bFactor = (EditText) findViewById(R.id.bFactor);
dDencity = (EditText) findViewById(R.id.dDencity);
lPita = (EditText) findViewById(R.id.lPita);
btnHBlocking = (Button) findViewById(R.id.btnHBlocking);
btnResetBlocking = (Button) findViewById(R.id.btnResetBlocking);
pPita = (EditText) findViewById(R.id.pPita);
lAkses = (EditText) findViewById(R.id.lAkses);
tRate = (EditText) findViewById(R.id.tRate);
}
private void initEvent1(){
btnHBlocking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hitungBlocking();
}
});
}
private void initEvent2(){
btnResetBlocking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetBlocking();
}
});
}
//METHOD UNTUK TOMBOL HITUNG BLOCKING
public void hitungBlocking() {
double jumlahRecord = Double.parseDouble(jRecord.getText().toString());
double panjangRecord = Double.parseDouble(pRecord.getText().toString());
double IBGIBG = Double.parseDouble(IBG.getText().toString());
double blokingFactor = Double.parseDouble(bFactor.getText().toString());
double dataDencity = Double.parseDouble(dDencity.getText().toString());
double lajuPita = Double.parseDouble(lPita.getText().toString());
double panjangPita = ((jumlahRecord/blokingFactor)*((blokingFactor*panjangRecord/dataDencity)+IBGIBG));
pPita.setText(panjangPita+" ");
double lamaAkses = panjangPita/lajuPita;
lAkses.setText(lamaAkses+" ");
double transferRate = jumlahRecord*panjangRecord/lamaAkses;
tRate.setText(transferRate+" ");
}
//METHOD UNTUK TOMBOL RESET BLOCKING
public void resetBlocking() {
jRecord.setText("");
pRecord.setText("");
IBG.setText("");
bFactor.setText("");
dDencity.setText("");
lPita.setText("");
pPita.setText("");
lAkses.setText("");
tRate.setText("");
}
}
- MTBlocking.java
public class MTBlocking extends ActionBarActivity {
EditText jRecord,pRecord,IRG,dDencity,lPita,pPita,lAkses,tRate;
Button btnHTBlocking,btnResetTBlocking;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mtblocking);
initUI();
initEvent1();
initEvent2();
}
private void initUI(){
//UNTUK MEMBACA INPUTAN DATA DAN TOMBOL HITUNG
jRecord = (EditText) findViewById(R.id.jRecord);
pRecord = (EditText) findViewById(R.id.pRecord);
IRG = (EditText) findViewById(R.id.IRG);
dDencity = (EditText) findViewById(R.id.dDencity);
lPita = (EditText) findViewById(R.id.lPita);
btnHTBlocking = (Button) findViewById(R.id.btnHTBlocking);
btnResetTBlocking = (Button) findViewById(R.id.btnResetTBlocking);
pPita = (EditText) findViewById(R.id.pPita);
lAkses = (EditText) findViewById(R.id.lAkses);
tRate = (EditText) findViewById(R.id.tRate);
}
private void initEvent1(){
btnHTBlocking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hitungTBlocking();
}
});
}
private void initEvent2(){
btnResetTBlocking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetTBlocking();
}
});
}
//METHOD UNTUK TOMBOL HITUNG TANPA BLOCKING
public void hitungTBlocking() {
double jumlahRecord = Double.parseDouble(jRecord.getText().toString());
double panjangRecord = Double.parseDouble(pRecord.getText().toString());
double IRGIRG = Double.parseDouble(IRG.getText().toString());
double dataDencity = Double.parseDouble(dDencity.getText().toString());
double lajuPita = Double.parseDouble(lPita.getText().toString());
double panjangPita = (jumlahRecord*((panjangRecord/dataDencity)+IRGIRG));
pPita.setText(panjangPita+" ");
double lamaAkses = panjangPita/lajuPita;
lAkses.setText(lamaAkses+" ");
double transferRate = jumlahRecord*panjangRecord/lamaAkses;
tRate.setText(transferRate+" ");
}
//METHOD UNTUK TOMBOL RESET TANPA BLOCKING
public void resetTBlocking() {
jRecord.setText("");
pRecord.setText("");
IRG.setText("");
dDencity.setText("");
lPita.setText("");
pPita.setText("");
lAkses.setText("");
tRate.setText("");
}
}
Untuk source code lebih lengkapnya bisa dilihat laporan diatas yaa :)Oke sekian dulu teman-teman, lain kali kita lanjut nugas lagi yaakk hehe :d
Posted in:
MKKonsentrasi,
Sistem Berkas
0 komentar for "TUGAS 01 SISTEM BERKAS -Organisasi Berkas pada Magnetic Tape-"
Leave a reply