【问题标题】:Multiplication and then sum?乘法然后求和?
【发布时间】:2016-09-26 13:42:49
【问题描述】:

我需要从 EditText 中获取一个数字并将其乘以一个标准数字,然后将其与从另一个 EditText 获取的数字相加,并将其乘以一个标准数字。
然后我必须在单击按钮时显示该值。

计算为:(editextnumber1 * standardnumber1) + (editextnumber2 * standardnumber2)

【问题讨论】:

  • 那有什么问题呢?

标签: java android android-studio


【解决方案1】:

参考以下代码:

    EditText e = (EditText) findViewById(R.id.edittext);
    int editextnumber = Integer.parseInt(e.getText().toString());
    int standardnumber = 10;  // your own value
    int result = editextnumber*standardnumber;

    // repeat the above procedure twice

【讨论】:

  • 如果您的问题得到解决,请选择此答案作为正确答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多