I'm not sure if this is for a class or if you're learning on your own but one thing you might want to look into are collections/arrays. If this is for a class then you'll be covering arrays and loops
in the near future (I assume) and are expected to answer this problem without the use of either loops or arrays?
I am going through the book on my own, and as far as my understanding goes, arrays and loops are coming up shortly
It is just an exercise in the book Introduction to
Java Programming Comprehensive Version 10th edition. under section 3 (boolean, if, switch) .
But before to do it with collections/arrays I need to improvise i guess so now what I have come up with is bellow, and I think it should work (At least when I was
testing few numbers). I also changed the major price to a shorter version
:
thanks for all the help