DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: New to Java

  1. #1
    Join Date
    Aug 2003

    Unhappy 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.


  2. #2
    Join Date
    Mar 2003


    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.