package com.example.calcutator.Calculator1;

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.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Calculator_1_9 extends AppCompatActivity {

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

    }

    public void Paper_weight_calculation(View v){
        EditText R_weight = findViewById(R.id.Raw_weight);
        EditText S_loss = findViewById(R.id.Shearing_loss);
        EditText P_axis = findViewById(R.id.Processing_axis);
        TextView P_weight = findViewById(R.id.Paper_weight);

        try{
            float paperweight = Float.parseFloat(R_weight.getText().toString());
            float shring = Float.parseFloat(S_loss.getText().toString());
            float makeper = Float.parseFloat(P_axis.getText().toString());
            double calcul = paperweight*((100-shring)/100)*100/(100-makeper);
            double calculround = Math.round(calcul*10)/10.0;

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

    }


}
