Meki Banda wrote:On the top of the page is a sample of how the program should run the loops are not working and its only executing one method. What is the problem with my code? Please Help!
In my opinion, the problem with your code is that you've written far too much of it. You've written a hundred lines and you're only now starting to test it - and that's a disaster waiting to happen.
Programming is (or should be) an incremental process, so if you write a loop, test it ... immediately. If you write a method, test it. And compile every ten lines you write (and some would say even less than that).
Yes, it means that you might have to write some code that you later remove (sometimes called "Kleenex code"), but you cannot expect to bash out a hundred lines of code and simply expect it to work.
Also: your code is very procedural. The only class you've written is the one you've been forced to; otherwise your program could have just as easily been written in C.
What about a Circle class that can return its own area? And maybe a Sphere class that can return its own area and volume? Do you see how that might be a better way to go?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java