package applicationtest1.example.android.myapplicationtest1;

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

public class MainActivity extends AppCompatActivity {
    Button Button1;
    Button Button2;
    Button Button3;
    Button Button4;

    EditText EditText1;
    EditText EditText2;

    EditText a ;
    EditText b ;
    int c ;




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

        Button1=(Button)findViewById(R.id.Button1);
        Button2=(Button)findViewById(R.id.Button2);
        Button3=(Button)findViewById(R.id.Button3);
        Button4=(Button)findViewById(R.id.Button4);
        EditText1=(EditText)findViewById(R.id.EditText1);
        EditText2=(EditText)findViewById(R.id.EditText2);




        Button1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {

              int a=Integer.parseInt(EditText1.getText().toString());
              int b=Integer.parseInt(EditText2.getText().toString());

              c = b + a ;


              Toast.makeText(MainActivity.this,String.valueOf(c), Toast.LENGTH_SHORT).show();



          }


      });



        Button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                int a=Integer.parseInt(EditText1.getText().toString());
                int b=Integer.parseInt(EditText2.getText().toString());

                c = b - a ;


                Toast.makeText(MainActivity.this,String.valueOf(c), Toast.LENGTH_SHORT).show();



            }


        });



        Button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                int a=Integer.parseInt(EditText1.getText().toString());
                int b=Integer.parseInt(EditText2.getText().toString());

                c = b * a ;


                Toast.makeText(MainActivity.this,String.valueOf(c), Toast.LENGTH_SHORT).show();



            }


        });



        Button4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                int a=Integer.parseInt(EditText1.getText().toString());
                int b=Integer.parseInt(EditText2.getText().toString());

                c = b / a ;


                Toast.makeText(MainActivity.this,String.valueOf(c), Toast.LENGTH_SHORT).show();



            }


        });


    }
}
