Multiplying with percentages
Page 1 of 18 Replies  1100 Views  Last Post: 25 January 2013  12:35 PM
#1
Multiplying with percentages
Posted 25 January 2013  08:17 AM
How can I automatically code my program so that when I type figures in a textbox, it will automatically be multiplied with a certain number and the answer of this multiplication will be in another textbox?
I have no coding yet, I have searched everything, but nothing helps me...
Please Help!!
Replies To: Multiplying with percentages
#2
Re: Multiplying with percentages
Posted 25 January 2013  08:19 AM
Easy peasy, right?
#3
Re: Multiplying with percentages
Posted 25 January 2013  08:33 AM
meaning
input 100
you want 10%
you cant do 100 x 10%
you have to do 100 x .1
keep that in mind
#4
Re: Multiplying with percentages
Posted 25 January 2013  08:34 AM
modi123_1, on 25 January 2013  08:19 AM, said:
Easy peasy, right?
Hi, uhm did you read what I need? I'm kinda asking for help with the coding to do so. I don't know how to code a multiplication... The only coding I got from a site, was to multiply some numbers with another number, but NOT with a percentage.
#5
Re: Multiplying with percentages
Posted 25 January 2013  08:47 AM
Quote
Hi, uhm, did you read the forum rules, FAQ, the giant yellow 'asking a question' box when you made the post, and the water mark in the post box that is telling you we won't do your homework or write the code for you, but... *BUT* will help guide you to write the code yourself? Yeah.. reread those!
After that buck up and just *TRY* following peeps have said here. I mean what's the worst that can happen? You gain the aplomb to get farther!
#6
Re: Multiplying with percentages
Posted 25 January 2013  09:17 AM
MafiaAndre, on 25 January 2013  10:34 AM, said:
Examples are good, but they are only examples and will only take you so far. You WILL eventually have to think for yourself.
So you want to multiply with percents? First, do you know how to convert whole numbers into percents on paper?
If you recall from basic math, percents are really fractions. So if you make your numbers like:
10  100
you get a fraction, then you might recall that if you divide the top number by the bottom number to get your percent in decimal form.
which would look like
myPercent = topNum / 100
Now you have the proper number to do the math with.
Next you gotta figure out how to use it.
One way I might do it:
1. Create a variable to store myPercent, myAnswer and whatever else I needed
2. Use TryParse() to convert the input from the textbox to a number
3. Do the math using the variables I've created
4. Use ToString() to convert myAnswer back into a string and display it in a label.
So now we have something of a plan, now we could bang out some code and see if it works.
If it doesn't we would use some debugging skills and try to fix it.
#7
Re: Multiplying with percentages
Posted 25 January 2013  10:36 AM
torind_2000, on 25 January 2013  09:17 AM, said:
MafiaAndre, on 25 January 2013  10:34 AM, said:
Examples are good, but they are only examples and will only take you so far. You WILL eventually have to think for yourself.
So you want to multiply with percents? First, do you know how to convert whole numbers into percents on paper?
If you recall from basic math, percents are really fractions. So if you make your numbers like:
10  100
you get a fraction, then you might recall that if you divide the top number by the bottom number to get your percent in decimal form.
which would look like
myPercent = topNum / 100
Now you have the proper number to do the math with.
Next you gotta figure out how to use it.
One way I might do it:
1. Create a variable to store myPercent, myAnswer and whatever else I needed
2. Use TryParse() to convert the input from the textbox to a number
3. Do the math using the variables I've created
4. Use ToString() to convert myAnswer back into a string and display it in a label.
So now we have something of a plan, now we could bang out some code and see if it works.
If it doesn't we would use some debugging skills and try to fix it.
I am not sure what to do. This is not doing my project for me or doing my homework. I'm developing this program for myself to use when doing TAX. I just need the basic coding, or an example, and I'll figure out how to use the sample coding in my project. Please?
#8
Re: Multiplying with percentages
Posted 25 January 2013  10:41 AM
Quote
Really? Let's take a few large steps backwards. How would you code up two variables multiplying against each other and storing in a third variable? You know a classic "a * b = c".
#9
Re: Multiplying with percentages
Posted 25 January 2013  12:35 PM
MafiaAndre, on 25 January 2013  12:36 PM, said:
Sure, I charge $100 dollars an hour, plus tax, with a 2 hour minimum. I accept Paypal, Visa, Mastercard, Discover, and Amex.
Or you could buy buy a book, like this one and learn this basic stuff yourself for way cheaper. Not to mention the satisfaction you'd get by learning something new then applying those skills to make your very own tax calculator.
