I want to display the average number in the textview. however, the output is always the integer. For example, my input num1 is 2 and 3. the output is 2.00. input: 2 and 7, the output is 4.00.
here is my code.
<string name="ave">Average: %1$.02f</string> //in strings.xml
//in main function
int num1 = Integer.parseInt(number1.getText().toString());
int num2 = Integer.parseInt(number2.getText().toString());
//get the average number
float average = ( num1 + num2 ) / 2;
ave_num.setText(getString(R.string.ave, average));