New to Java
I am a new user to Java, I am looking to make a simple program which asks a user a number between 1-20. And the program will simply calculate the sum of the number...
for instance a user will enter the number 4
The program will calculate it as:
1/1 + 1/2 + 1/3 + 1/4 =
Help would be gratefully appreciated.
This sounds awfully like homework to me...and you won't get anyone here writing it for you (if they do, I'll just delete their post......one of the joys of being a moderator).
Seriously, we won't do it for you, but we're more than happy to help you with guidance, advice and bugs (solving them, not producing them...usually!).
SO....what problem are you having?
As I see it, you need to understand several things to get this program to work:
1. How to display a message to the user.
2. How to get input from the user.
3. How to convert that input from text into a number
4. How to perform arithmetic.
5. How to use loops.
This problem, now broken up into chunks should seem more managable. I therefore suggest that you start working down this list making sure you know how to do each of the tasks, building the program as you go. If you run into problems, post the code you have so far and explain the problem you're having or what you don't understand. THEN we can help you.
I don't mean to be mean (well, maybe a little), but it really is more helpful to you in the long run if you do things like this.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center