Junilu Lacar wrote:There are lots of errors in the code you posted. The lack of proper formatting makes it difficult to spot them though.
1. Your calcTotals() method is declared inside the main() method. You can't do that.
2. You have a number of variables which you declare twice. That's not a good practice as it can lead to errors and/or confusion.
3. You have semi-arbitrary code blocks where a code block is not necessary. In fact, some of those arbitrary code blocks contribute to the confusion.
Here's your code properly formatted and indented (I suggest you pay more attention to this detail in the future if you want to avoid unnecessary headaches—you're shooting yourself in the foot, in the arm, in the stomach, etc. by not formatting your code properly):