Commit c2ffcb51 authored by Rodolphe Leligois's avatar Rodolphe Leligois


parent 67984c05
package fr.randulphe.pourcentage;
import android.os.Bundle;
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;
protected void onCreate(Bundle savedInstanceState) {
solution = (TextView) findViewById(;
percentage = (EditText) findViewById(;
value = (EditText) findViewById(;
Button calculate = (Button) findViewById(;
calculate.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
float percen = Float.parseFloat(percentage.getText().toString());
float dec = percen/100;
float sol = dec * Float.parseFloat(value.getText().toString());
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