Binary Ranger
Banned
- Messages
- 67
- Location
- Midgard
Hello all! How has it been going? I'm here to ask for your assistance with a project of mine. Here is the lowdown.
I was given a program to edit. The previous person who wrote it intentionally screwed it up to point of it not being worth fixing. Regardless, I fixed it... sort of. There is but on flaw in this program now!
The program will not display the value I want in terms of decimal double digits.
Here is what I mean. The program asks the user for the number of hours they work. Lets say they work 40. The program then multiplies this by a constant of 12.50 (That's the number that was specified. It does NOT change in this program). Now, the program displays the net pay but it only displays it with one, or no decimal depending on the amount. (i.e. it will display 500 for the 40 * 12.50 instead of 500.00 and if 45 is entered it will only display 562.5 instead of 562.50)
I am using doubles to store the constant and the netPay and was using an int to store the hours. I believe this could be where the problem lies but I am really unsure. Any help would be much appreciated.
EDIT - Using C++
I was given a program to edit. The previous person who wrote it intentionally screwed it up to point of it not being worth fixing. Regardless, I fixed it... sort of. There is but on flaw in this program now!
The program will not display the value I want in terms of decimal double digits.
Here is what I mean. The program asks the user for the number of hours they work. Lets say they work 40. The program then multiplies this by a constant of 12.50 (That's the number that was specified. It does NOT change in this program). Now, the program displays the net pay but it only displays it with one, or no decimal depending on the amount. (i.e. it will display 500 for the 40 * 12.50 instead of 500.00 and if 45 is entered it will only display 562.5 instead of 562.50)
I am using doubles to store the constant and the netPay and was using an int to store the hours. I believe this could be where the problem lies but I am really unsure. Any help would be much appreciated.
EDIT - Using C++
Last edited: