|
I am a beginner with Java myself, and I recently had a program like this
I think what you are asking is how to possibly get the input from the user, and have it output the answer to the screen.
What I do to help myself with some of the programs is to make some pusedo code of what exactly needs to happen, or make a flowchart so you can physically see what you want the program to do.
Here are some tips that helped me, mabey they will work for you as welll;
*I do all my initial stuff on paper first, its just helps me before I start the actual code
*Ask yourself what input you want from the user then capture it
*Ask yourslef what output you want to print to the screen then capture it
*Try to declair your variables first, then after they are declaired skip down a few lines and initialize them
*Start off with your first promt to the user
*Then do the second promt (if any)
*Code your algorythm then output it to the screen
*Alawys show the line numbers, this really helps when you compile it it will tell you the line the errors are on, if any, and give you a suggestion as how to fix it.
Hope this helps you a bit and dosent confuse you, post your code to the forums when you get it if you have any more questions.
|