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_8 extends AppCompatActivity {
    EditText one;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calculator_2_8);
        one = findViewById(R.id.BeamSpeed);
        one.requestFocus();
    }
    public void BeamLenght_Calculation(View v){

        EditText two = findViewById(R.id.Beam_inner);
        EditText three = findViewById(R.id.Beam_outer);
        TextView result = findViewById(R.id.Yarn_length);
        try{
            float Beam_speed = Float.parseFloat(one.getText().toString());
            float Beam_inner = Float.parseFloat(two.getText().toString());
            float Beam_outer = Float.parseFloat(three.getText().toString());
            double calcul =Beam_inner+Beam_outer;
            double calculround = calcul*Beam_speed/2000;

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


    }

}
