hello all, i recently purchase Serendipity and im having trouble with my code on not wanting to display my total, subtotal and tax rate. i manage to get this far but i feel like im missing something but i cant seem to pinpoint it.
here is part of the code.
the out put displays everything corrrectly but my total, tax and subtotal all displays 0.
any reason why...
i have a feeling it something minor but i cant pinpoint it.
Tax/total will both be 0 with that first line commented out but I assume you know that and did it for testing. You are currently using "qty" and "price" as dynamically allocated arrays with "numberOfTitles" as the number of elements as shown here.
So subtotal = subtotal + (qty*price); isn't going to work, you need to pick a specific element from those arrays. For example subtotal = subtotal + (qty[0]*price[0]); would give you the values for the 1st element in the arrays. I am guessing you will want to loop through every element using a for loop as you did previously.
Enter date as : 2
Number of titles in purchase: 2
BOOK 1
Enter Book Quantity: 3
Enter ISBN number : 4
Enter title : 5
Enter unit price: 6
BOOK 2
Enter Book Quantity: 3
Enter ISBN number : 5
Enter title : 6
Enter unit price: 3
Qty ISBN Title Price Total
upX86 i tred that but im currenty getting this out put. the correct answered should have been 6*2 qty=12+(7*3qty)=21=33+tax =34.26 as total. but im getting 22. unless im doing something wrong
Upx86 it took me a while to see what i was missing which was subtotal = 0.0. not having that gave me miscalculations. oh and more transaction (Y/N) is asking if the user wants to do another transaction. thanks for your help