package com.example.calcutator.Calculator2;

import android.os.Bundle;

import com.example.calcutator.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import org.w3c.dom.Text;

public class Calculator_2_3 extends AppCompatActivity {
    EditText count;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calculator_2_3);
        count=findViewById(R.id.bon_default);
        count.requestFocus();
    }
    public void bon_calculation(View v){

        EditText in=findViewById(R.id.bon_in);
        EditText out=findViewById(R.id.bon_out);
        TextView real=findViewById(R.id.bon_real_count);

        try{
            int bon_default=Integer.parseInt(count.getText().toString());
            int bon_in=Integer.parseInt(in.getText().toString());
            int bon_out=Integer.parseInt(out.getText().toString());

            float calcul=bon_default/(bon_in+bon_out)*bon_in;

            real.setText(calcul+"");

        }catch (NumberFormatException e){
            Toast.makeText(this.getApplicationContext(),"값을 제대로 입력해 주세요", Toast.LENGTH_LONG).show();
        }



    }


}
