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;

public class Calculator_2_7 extends AppCompatActivity {

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


    public void papercal(View v){
        EditText beamMeter = findViewById(R.id.beamMeter);
        EditText beamInnerdiameter = findViewById(R.id.beamInnerdiameter);
        EditText beamOuterdiameter = findViewById(R.id.beamOuterdiameter);
        TextView beamSpeed = findViewById(R.id.beamSpeed);

        try{
            float beammeter = Float.parseFloat(beamMeter.getText().toString());
            float beaminnerdiameter = Float.parseFloat(beamInnerdiameter.getText().toString());
            float beamouterdiameter = Float.parseFloat(beamOuterdiameter.getText().toString());
            double calcul = beammeter*2000;
            double calculround = calcul/(beaminnerdiameter+beamouterdiameter);

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



    }


}
