Hi i have to write a code that allows the user to key in any number of item prices for items purchased in a discount store. Display the grand total amount of all items including an addition of 8% tax on all items. this is what i have so far, I can get it to compile and run but it doesn't seem to be right.
Ctrygirl, i have not looked at your code but might I recommend something for determining if your values are right?
I was always taught in school to test these kinds of functions by hand, that is.. get a calculator, plug in some numbers to fit the equation(i assume its just the total of your items and add the .08% tax)
So try somethign liek this on paper.
item 1 : 50.0
item 2 : 28.3
item 3: 40.9
item total : 50.0 + 28.3 + 40.9
tax : (50.0 + 28.3 + 40.9) * .08
grand total : Total + tax
now plug those same numbers into your program
Does your program return the same value as a grand total? If it does, your code appears to be working properly (;
You can run the pen paper calculator test a few times if you don't feel secure with just one run through.
I changed some stuff you can check it out see if you like dislike w-e. you did have a couple lil issues in there . for one temp needs to be a double an prolly more effectively an array here you'll c
marky only gave you a sample of code to be added in to your program. He didn't give you a complete program all on it's own. It's supposed to lead you in the direction of critical thought and self-education, not do it for you. See if you can find a way to add marky's code into your original program.