Commit c2ffcb51 authored by Rodolphe Leligois's avatar Rodolphe Leligois

Delete MainActivity.java

parent 67984c05
package fr.randulphe.pourcentage;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.lang.String;
import android.view.View.OnClickListener;
import static java.lang.Float.parseFloat;
public class MainActivity extends AppCompatActivity {
TextView solution;
EditText percentage;
EditText value;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
solution = (TextView) findViewById(R.id.solution);
percentage = (EditText) findViewById(R.id.percentage);
value = (EditText) findViewById(R.id.value);
Button calculate = (Button) findViewById(R.id.calculate);
calculate.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
float percen = Float.parseFloat(percentage.getText().toString());
float dec = percen/100;
float sol = dec * Float.parseFloat(value.getText().toString());
solution.setText(Float.toString(sol));
}
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment