• <small id='olY6c'></small><noframes id='olY6c'>

  • <i id='olY6c'><tr id='olY6c'><dt id='olY6c'><q id='olY6c'><span id='olY6c'><b id='olY6c'><form id='olY6c'><ins id='olY6c'></ins><ul id='olY6c'></ul><sub id='olY6c'></sub></form><legend id='olY6c'></legend><bdo id='olY6c'><pre id='olY6c'><center id='olY6c'></center></pre></bdo></b><th id='olY6c'></th></span></q></dt></tr></i><div id='olY6c'><tfoot id='olY6c'></tfoot><dl id='olY6c'><fieldset id='olY6c'></fieldset></dl></div>

    1. <tfoot id='olY6c'></tfoot>
        <bdo id='olY6c'></bdo><ul id='olY6c'></ul>
    2. <legend id='olY6c'><style id='olY6c'><dir id='olY6c'><q id='olY6c'></q></dir></style></legend>

        运行总 C#

        时间:2023-06-05

        <small id='Cqmjz'></small><noframes id='Cqmjz'>

      1. <i id='Cqmjz'><tr id='Cqmjz'><dt id='Cqmjz'><q id='Cqmjz'><span id='Cqmjz'><b id='Cqmjz'><form id='Cqmjz'><ins id='Cqmjz'></ins><ul id='Cqmjz'></ul><sub id='Cqmjz'></sub></form><legend id='Cqmjz'></legend><bdo id='Cqmjz'><pre id='Cqmjz'><center id='Cqmjz'></center></pre></bdo></b><th id='Cqmjz'></th></span></q></dt></tr></i><div id='Cqmjz'><tfoot id='Cqmjz'></tfoot><dl id='Cqmjz'><fieldset id='Cqmjz'></fieldset></dl></div>

            <tbody id='Cqmjz'></tbody>
              <bdo id='Cqmjz'></bdo><ul id='Cqmjz'></ul>
            • <tfoot id='Cqmjz'></tfoot>
                1. <legend id='Cqmjz'><style id='Cqmjz'><dir id='Cqmjz'><q id='Cqmjz'></q></dir></style></legend>

                2. 本文介绍了运行总 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在创建一个捐赠应用程序,它读取文本框中的输入,将其转换为双精度.然后使用 operatingCost 方法,它应该将转换后的两倍除以 17%(营业费用).目前在该方法中,我有变量 dontationBFees 进入,然后除以 17 并创建一个新变量 afterFees.一切正常,但我需要创建一个运行总计来保存所有捐款.它应该显示截至该点的所有捐赠为慈善机构筹集的总金额(即捐赠的总金额减去所有运营成本).我知道我需要一个 while 循环或执行 while 循环,以便应用程序运行并不断添加数据.我只是不明白为什么这段代码没有产生运行总数.我正在寻求帮助.有什么我忽略的.

                  I'm creating a donation application that reads the input in a textbox, converts it to a double. Then using the method operatingCost, it should take that converted double and divide it by 17% (operating fees). Currently in the method, I have the variable dontationBFees coming in and then being divided by 17 and creating a new variable afterFees. Everything is working fine but I need to create a running total that will save all of the donations. It should display the total amount raised for the charity (that is, the total amount donated less all operating costs) for all donations up to that point. I know I need a while loop or do while loop so that the app runs and keeps adding the data. I just don't see why this code isn't producing the running total. I'm looking for help. Is there something I'm overlooking.

                     private decimal donationBFees = 0;
                  
                      void deductOperatingCost(ref decimal afterFeesParam)
                      {
                          afterFeesParam = afterFeesParam - (afterFeesParam  / 100 * 17);
                      }
                  
                  
                      private void Button_Click(object sender, RoutedEventArgs e)
                      {
                          Boolean set = true;
                          do
                          {
                  
                              String donationBeforeFees;
                              decimal totalDonationRaised;
                  
                              donationBeforeFees = donationBox.Text;
                              donationBFees = System.Convert.ToDecimal(donationBeforeFees);
                  
                  
                              decimal afterFees = donationBFees;
                              deductOperatingCost(ref afterFees);
                              afterFeesBox.Text = afterFees.ToString("$###, ##0.00");
                  
                              //This is the for loop I'm using to get the running total
                              for (int i = 0; i < afterFees; i++)
                              {
                                  decimal total = 0;
                                  total += afterFees;
                                  totalDonationRaised = total;
                                  totalDonationsBox.Text = totalDonationRaised.ToString("$###, ##0.00");
                              }
                  
                          } while (set == false);
                      }
                  
                  }
                  

                  }

                  推荐答案

                  我正在尝试使用这种方法来计算运行总数,但是当我删除它们时它会增加数字.

                  I'm trying to use this method for the running total but its adding number when I delete them.

                      private decimal donationBFees = 0;
                      private decimal total = 0;
                      private decimal afterFees = 0;
                      private decimal totalDonationRaised;
                  
                      void deductOperatingCost(ref decimal afterFeesParam)
                      {
                          afterFeesParam = afterFeesParam - (afterFeesParam  / 100 * 17);
                      }
                  
                      void runningTotal(ref decimal runningTotalParam)
                      {
                          runningTotalParam = runningTotalParam + runningTotalParam;
                      }
                  
                      private void Button_Click(object sender, RoutedEventArgs e)
                      {
                  
                  
                              String donationBeforeFees;
                  
                  
                              donationBeforeFees = donationBox.Text;
                              donationBFees = System.Convert.ToDecimal(donationBeforeFees);
                  
                  
                              decimal afterFees = donationBFees;
                              deductOperatingCost(ref afterFees);
                              afterFeesBox.Text = afterFees.ToString("$###, ##0.00");
                  
                              total = afterFees;
                              totalDonationRaised = total;
                              totalDonationsBox.Text = totalDonationRaised.ToString("$###, ##0.00");
                  
                      }
                  
                      private void donationBox_TextChanged(object sender, TextChangedEventArgs e)
                      {
                          //total += afterFees;
                  
                          runningTotal(ref total);
                          totalDonationRaised = total;
                          totalDonationsBox.Text = totalDonationRaised.ToString("$###, ##0.00");
                      }
                  
                  }
                  

                  这篇关于运行总 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:单击带有 JAvascript.ASP.NET C# 的超链接时删除目录 下一篇:Unity中图像的onClick事件

                  相关文章

                  最新文章

                  1. <small id='wufnC'></small><noframes id='wufnC'>

                  2. <tfoot id='wufnC'></tfoot>
                  3. <i id='wufnC'><tr id='wufnC'><dt id='wufnC'><q id='wufnC'><span id='wufnC'><b id='wufnC'><form id='wufnC'><ins id='wufnC'></ins><ul id='wufnC'></ul><sub id='wufnC'></sub></form><legend id='wufnC'></legend><bdo id='wufnC'><pre id='wufnC'><center id='wufnC'></center></pre></bdo></b><th id='wufnC'></th></span></q></dt></tr></i><div id='wufnC'><tfoot id='wufnC'></tfoot><dl id='wufnC'><fieldset id='wufnC'></fieldset></dl></div>
                    <legend id='wufnC'><style id='wufnC'><dir id='wufnC'><q id='wufnC'></q></dir></style></legend>

                    • <bdo id='wufnC'></bdo><ul id='wufnC'></ul>