I have to make a program that simulates a shopping cart, I have it done, it's just that the shopping cart wont print. Please help me in fixing this, this is due for me tomorrow and is worth 40% of this chapter grade.
The files are attached below. The main one is ShoppingSim.java
Alishaikh
-3
Light Poster
Recommended Answers
Jump to PostYou didn't ask a question or explain what was wrong with the program. Surely if you've worked on it you know an area where your code doesn't work.
Jump to Postjust post the code you want us to review here, not in attachment.
as far as I understand from your description, you've got an array of some sort, containing objects of a class (for instance, Product)to print those: iterate over the elements of the array, and print each …
Jump to PostFrom a quick look at your code you have this:
case 2: mart.print(); // Call break to avoid falling through to the default case. break;
It is suppose to print the shopping cart. Are you having problems with that?
Jump to PostOh, I think it's printing the cart just fine.
The problem is that your menu choice handler creates a new cart every time it's called.
All 13 Replies
BestJewSinceJC
700
Posting Maven
stultuske
1,116
Posting Maven
Featured Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Alishaikh
-3
Light Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Alishaikh
-3
Light Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Alishaikh
-3
Light Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Alishaikh
-3
Light Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Alishaikh
-3
Light Poster
Alishaikh
-3
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.