hello,
I'm trying to display a result from 2 inputs calculations from minutes to HHMM, however when I try and calculate it with the below code only the HH changes to the current hour. eg. 129 will only display as 02:00. I have tested it by adding num1 with num2 and this does indeed display as hhmm, but I need the multiplications & divisions to take place
I'm new to this so any advice is appreciated.
EditText e1 = (EditText) findViewById(R.id.Distance); EditText e2 = (EditText) findViewById(R.id.Height); TextView t1 = (TextView) findViewById(R.id.Result); Integer num1 = Integer.parseInt(e1.getText().toString()); Integer num2 = Integer.parseInt(e2.getText().toString()); Integer sum = (int) ((num1 / 5 * 60) + (num2 / 600 * 60)); int hours = sum / 60; int minutes = sum % 60; t1.setText(String.format("Estimated time: %d hr : %02d min", hours, minutes)); } }