Java Android Studio中的GST计算错误

问题描述

我在gst计算中有一些错误。我正在通过Android Studio创建用于Android的GST计算应用。

错误是使用公式计算gst排除量

gstAmount = (totalAmount * gstPercentage)/100; 

它工作正常,没有任何错误,但是当我将此转换为含gst时,我使用以下公式

gstAmount = totalAmount - (totalAmount * (100 / (100 + gstPercentage))); 

金额未到。我不知道这是什么错误

GST专用:

private void showGSTLayout(int gstPercentage){
    gstAmount = (totalAmount * gstPercentage)/100;
    totalAmountWithGST = totalAmount + gstAmount;

    gstTagCaculations.setText("GST (" + gstPercentage + "%)");
    gstAmountCaculations.setText(formateAmount(gstAmount));
    partGSTAmountCalculations.setText("( CGST("+ (gstPercentage/2.0) +"%) = " + formateAmount(gstAmount/2.0) + " )\n( SGST(" + (gstPercentage/2.0) + "%) = " + formateAmount(gstAmount/2.0) + " )");
    totalAmountWithGSTCaculations.setText("= " + formateAmount(totalAmountWithGST));

    gstLayoutCaculations.setVisibility(View.VISIBLE);

    clearKey.setText("AC");
}

商品及服务税包括:不起作用的商品:

private void showGSTLayout(int gstPercentage){
    gstAmount = totalAmount - (totalAmount * (100 / (100 + gstPercentage)));
    totalAmountWithGST = totalAmount - gstAmount;

    gstTagCaculations.setText("GST (" + gstPercentage + "%)");
    gstAmountCaculations.setText(formateAmount(gstAmount));
    partGSTAmountCalculations.setText("( CGST("+ (gstPercentage/2.0) +"%) = " + formateAmount(gstAmount/2.0) + " )\n( SGST(" + (gstPercentage/2.0) + "%) = " + formateAmount(gstAmount/2.0) + " )");
    totalAmountWithGSTCaculations.setText("= " + formateAmount(totalAmountWithGST));

    gstLayoutCaculations.setVisibility(View.VISIBLE);

    clearKey.setText("AC");
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)