Feb 15, 2012 at 7:04am Feb 15, 2012 at 7:04am UTC
It doesn't look like you initialize or calculate totalTax before you use it. In fact, you calculate it on the line after:
sales=collection-totalTax;
totalTax=SaleCountyTax+SaleTaxState;
Feb 15, 2012 at 7:07am Feb 15, 2012 at 7:07am UTC
Thanks :D but I am still getting the error for SaleCountyTax & SaleTaxState.. eh, I have no idea why
Feb 15, 2012 at 7:10am Feb 15, 2012 at 7:10am UTC
What exactly is the error?
It helps to know more than "I'm getting errors."
All right, what I'm seeing: you're using SaleCountyTax & SaleTaxState, but these two variables are neither initialized nor calculated before hand.
I think perhaps you have the calculations out of order.
Also:
sales=collection-totalTax;
This is typically called a sub-total until it is actually recorded on the accounting books.
Last edited on Feb 15, 2012 at 7:19am Feb 15, 2012 at 7:19am UTC
Feb 15, 2012 at 7:12am Feb 15, 2012 at 7:12am UTC
Oh sorry! It's "the variable is being used without being initialized" & its referring to my previous post
Feb 15, 2012 at 7:48am Feb 15, 2012 at 7:48am UTC
Ok, I need to work this out on paper(web paper) because it looks like you got yourself into a paradox here. NOTE: This is not in the order you need to calculate in a program.
collection = sales + totalTax;
totalTax = (TotalStateTax + TotalCountyTax);
TotalStateTax = sales * StateTax;
TotalCountyTax = sales * CountyTax
sales = collection - totalTax?
You have a problem here in that you can't know sales w/o knowing collection and you can't know collection w/o knowing sales.
Last edited on Feb 15, 2012 at 7:50am Feb 15, 2012 at 7:50am UTC
Feb 15, 2012 at 7:05pm Feb 15, 2012 at 7:05pm UTC
I see, but the user inputs the collection...hmmmmmmmmmm
Feb 15, 2012 at 7:21pm Feb 15, 2012 at 7:21pm UTC
My math is skewed..i see, i'll try another approach - if you see a fix, let me know :D