package com.example.myapplication; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnHesapla = findViewById(R.id.buttonHesapla); btnHesapla.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText editTextCihazAdi = findViewById(R.id.editTextCihazAdi); EditText editTextKW = findViewById(R.id.editTextKw); EditText editTextGunlukKullanimSaat = findViewById(R.id.editTextGunlukKullanimSaat); TextView textViewSonuc = findViewById(R.id.textViewSonuc); String cihazAdi = editTextCihazAdi.getText().toString(); int kw = Integer.parseInt(editTextKW.getText().toString()); int saat = Integer.parseInt(editTextGunlukKullanimSaat.getText().toString()); ElektrikliCihaz cihaz1 = new ElektrikliCihaz(); cihaz1.cihazAdi = cihazAdi; cihaz1.cihazKW = kw; cihaz1.gunlukSaatKullanim=saat; int sonuc = cihaz1.aylikTuketim(); textViewSonuc.setText(Integer.toString(sonuc)); } }); } }