you should correct that as well. Also, if you want to calculate the values again then you need to put everything in loop to check the condition..
Tushar Goel wrote:Also at line 63, you are comparing with "N", if its not "N" then terminate the loop. So when you are enter "Y" it will be terminated.
You should correct that as well. Also, if you want to calculate the values again then you need to put everything in loop to check the condition..
whats a better way of doing it without termination the loop
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?