This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm very new to java and I'm having a hard time with it. My assignment is to create a Multiplication Times Table from 0-12 with any number and ask the user if he or she wants to see another number to be displayed again for the times table, if yes the times table runs again with another number from the user and then asks the user if they want to see another number yes or no and if no the program can exit. I've been trying for a week now and I'm having a hard time figuring it out. here is the code I got for the times table to work but I can't get a loop to work to repeat. Any help or examples would greatly be appericated. Thank You
David Kurey wrote:Can someone just get me started with the code I got posted and point out what I have to do? I need user input
I'm pretty sure I did point out what you need to do. I"m pretty sure you are also already getting user input.
Can you look at your code in your first post, and identify which lines print out your table? I'll give you a hint - there are three lines all together that do this.
Move those into a method, and replace them in main with a call to the method.
start over. write a main method that only prints "I'm in main". get that to compile and run. Once you've done that, write a method that prints "I'm in the method", and have your main call it. once THAT works, change it so that you can pass in a parameter - like a 7 or a 42. Update the method to print out the value passed in.
Each time you make a little change like this, re-compile, debug, and test. Make sure it really does what you want.
Eventually you will have a method that you can pass in a number, and it will print out the times table for that number. You may have your main call it 2-3 times with different values to prove to yourself it works.
Once you have that method working, then you can start looking at getting user input.
The beauty here is that once you have a method that takes an int as a param and prints the times table, it DOESN'T MATTER how you GET that number. You can read from a file, you can hard-code it, you can ask for user input...
you want to separate the different pieces of your code as much as possible.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Need Help with asking user input for Times Table number