sorry about posting in the wrong forum... I'm a student, and to be honest, I don't know what the difference is between C++/CLI or any other C++ programing. All I know is that it's C++ and this forum has "C++" in the title. Sorry again. Ruby
RubyM
Posts
-
calculating conversion question... -
calculating conversion question...This is more on the mathematical side but I'm trying to convert metrics to english and vice versa. I've got the main coding done but my equations are off. Maybe it's because I've been working on this for about 3 days straight and just cannot see what I'm doing wrong, OR I'm just have no clue as to what I am doing in the first place. LOL here is the code I have for converting metric to english (grams and kilograms to pounds and ounces): const double KILOGRAMS_PER_POUND = .454; const double POUNDS_PER_KILOGRAM = 2.2046; const double GRAMS_PER_KILOGRAM = 1000; const double OUNCES_PER_POUND = 16; const double GRAMS_PER_POUND = 453.59; void convert_M_to_E( double £s, double& ounces, double grams, double kilograms) // Parameters: Grams and kilograms values to be converted to pounds and ounces // and references to variables that hold pounds and ounces // Returns: None // Calls: None { double total_pounds; // Grams and kilograms converted to pounds double total_grams; // Pounds and ounces converted to grams total_grams = grams + kilograms / GRAMS_PER_KILOGRAM; total_pounds = total_grams / GRAMS_PER_POUND; pounds = int( total_pounds ); ounces = pounds/OUNCES_PER_POUND; } // End of convert_M_to_E() And here is the code I have to convert English to Metric: void convert_E_to_M( double pounds, double ounces, double& grams, double& kilograms) // Parameters: pounds and ounces values to be converted to grams and kilograms // and references to variables that hold grams and kilograms // Returns: None // Calls: None { double total_pounds; // pounds and ounces converted to pounds double total_grams; // pounds and ounces converted to grams total_pounds = (pounds + ounces)/OUNCES_PER_POUND; total_grams = GRAMS_PER_POUND * total_pounds; grams = double (total_grams); kilograms = grams/GRAMS_PER_KILOGRAM; } // End of convert_E_to_M() I know I've got it completely wrong... can anyone help?? Thanks, Ruby
-
Summary problemGot it!! Thanks so much for your help!! It works great now. :-D Ruby
-
Summary problemok, I stepped through the debugger and don't seem to find any problems (then again, I'm am new to this and probably didn't know what to look for) the message box shows all of the messageString, but somewhere along the line it is not doing the calculations like it should. If I have the deposit button checked and enter 3 transactions of $50 then click on the "check" button and enter a transaction of $100 then choose the summary option in my menu the summary should look like this: Total Deposits: 3 Amount of Deposits: $150 Total checks: 1 Amount of Checks: $100 Total Service charge: $0 but instead it will only show this: Total Deposits: 0 Amount of Deposits: 0 Total checks: 1 Amount of checks: $100 Total Service charge: $0 I also tried it without the ToString() call and I get "0" for everything in my summary, so I do need the ToString() call. So that's my problem. It's not holding all of the transactions like it should so I can display them in my summary. Ruby
-
Summary problemok, here is the code: Public Class CheckingAccount Dim Service = "10.00" Dim enterAmount As Decimal Dim Balance As Decimal Dim totalNumOfDeposit As Integer Dim totalAmtOfDeposits As Decimal Dim totalChecks As Decimal Dim totalAmountOfChecks As Decimal Dim totalAmountOfService As Decimal Private Sub menTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menTransaction.Click With Me enterAmount = Decimal.Parse(txtAmount.Text) If butDeposit.Checked = True Then Balance = Balance + enterAmount totalNumOfDeposit = totalNumOfDeposit + 1 totalAmtOfDeposits = totalAmtOfDeposits + enterAmount ElseIf butCheck.Checked = True Then Balance = Balance - enterAmount totalChecks = totalChecks + 1 totalAmountOfChecks = totalAmountOfChecks + enterAmount ElseIf butService.Checked = True Then Balance = Balance - Service totalAmountOfService = totalamountOfChecks + Service End If Me.txtBalance.Text = Balance.ToString("C") Me.txtAmount.Clear() Me.txtAmount.Focus() End With End Sub Private Sub menSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menSummary.Click Dim Service As Decimal = "10.00" Dim totalNumOfDeposit As Integer Dim totalAmtOfDeposits As Decimal Dim totalChecks As Decimal Dim totalAmountOfChecks As Decimal Dim totalAmountOfService As Decimal Dim messageString As String With Me If butDeposit.Checked = True Then totalNumOfDeposit = totalNumOfDeposit + 1 totalAmtOfDeposits = totalAmtOfDeposits + enterAmount ElseIf butCheck.Checked = True Then totalChecks = totalChecks + 1 totalAmountOfChecks = totalAmountOfChecks + enterAmount ElseIf butService.Checked = True Then totalAmountOfService = totalAmountOfService + Service End If messageString = "Total Deposits: " _ & totalNumOfDeposit.ToString() _ & ControlChars.NewLine _ & "Total Amount Of Deposits: " & totalAmtOfDeposits.ToString() _ & ControlChars.NewLine _ & "Total Checks: " & totalChecks.ToStri
-
Summary problemI am currently enrolled in a VB class and am completely new to the class and this forum so if you need any additional information please let me know. I hope this question makes sense to someone. lol My current project requires me to do a summary with a running total of the number of deposits, amount of deposit, number of checks, amount of checks etc. I am able to get the summary up in a new messagebox but it will only show the last transaction. for instance if I make a deposit, then write a check, the summary will only show the check written and the amount of the check. It will not show the deposit I made or the amount of the deposit. How can I get it to show all of the totals from all of the transactions? If you need any code I can provide it for you. Thanks, Ruby