Qbasicnews.com

Full Version: percent form to decimal.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I need to write a program for school again, the problem that I have
is with the calucation.

I understand that I have to have it do ,

Sales Tax Amount = Sales Tax Rate * Sale Amount
Total Sale Amount = Sale Amount + Sales Tax Amount

But I need to be able to change the State Sales tax from Percent to Decimal. This way when you input the state tax as 7 % it would calculation it into decimal...Could someone help me in understanding how to make it work. I am not asking for someone to do my work, only asking for help in how to write the code for the Calculation...

I am new to QB, I am useing QB4.5 I also have QB7.1 Not sure which is better, hopeing someone could tell which one is better.
I am really getting into makeing programs, to me this is the best class that I have so far...


Thank You
Joseph L. Gelsomino
Well, how would you do it if you had a calculator? It's the same approach. Divide by 100.
Quote:Well, how would you do it if you had a calculator? It's the same approach. Divide by 100.

I understand that, all it is is 7 / 100 which comes out to 0.07

just not sure how to write it useing the LET statement, we are only in our 4 class...

LET sales tax amount = tax / 100???
Try it.
And btw, you don't need to use LET... here's an example of some basic math:

Code:
' Adding two numbers together and storing the result in foo:
foo = 6 + 14    ' foo now = 20

' Subtraction...
foo = 67 - 13   ' foo is now 54

' Multiplication...

foo = 8 * 3   ' foo is now 24

' Division...

foo = 9 / 3  ' foo is now 3

' MOD operator (the remainder of division)

foo = 10 MOD 3   ' foo is 1, because 10 / 3 = 3 and 1 remainder
foo = 18 MOD 5   ' foo is 3, because 18 / 5 = 3 and 3 remainder
Wack,
Take Plasma's good advice and first work out your calculations using a calculator or pencil and paper. When you have these working right, then transfer the logic to your program. If your program does not give the same answers, then you have a coding error somewhere. It's as simple as that. Working out the calculations by hand in advance gives you the added advantage of knowing the answers that your program should give. This is definitely good programming practice.
*****
Most of us here use paper and pencil before starting any project

BTW post your code here when you think you have it for this problem
Quote:Most of us here use paper and pencil before starting any project

BTW post your code here when you think you have it for this problem

I just got home from school, and I do just like the rest of you. I write it down on paper first. I live in the U.S. its 9:19 pm here.
As soon as I got it down on paper I will post it...BTW which is better QB4.5 or QB7.1 I have both...
and thank you all for the help you have been giveing me so far, you have to understand you are all young were as I am 49...got out of school in 72
If you want a simplified mathematical version, just use:

(number) * 10^-2

and viceversa if you wanted the decimal as a percent.
Quote:...BTW which is better QB4.5 or QB7.1 I have both...

QB45: the popular choice
QB71: has some advanced features, but those features won't work with the people who don't have QB45.
Pages: 1 2