package com.example.currencyconverter;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    public void convertor(View view){
        Log.i("info","button pressed");
        EditText editText=(EditText)findViewById(R.id.editText2);
        String amount = editText.getText().toString();
        Double amountinpoundsDouble = Double.parseDouble(amount);
        Double amountindollarsDouble  = amountinpoundsDouble * 1.24;
        String amountString = String.format("%.2f",amountindollarsDouble);
        Toast.makeText(this, "$"+amountString,Toast.LENGTH_LONG).show();

    }

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