Results 1 to 3 of 3
  1. #1
    esined93 is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Arrays and for-loops??

    Hello! I am trying to write a program that reads in five numbers and then writes out:
    -The sum of the five numbers
    -The average value of the five numbers
    - The largest of the five numbers

    The numbers should be stored in an array and I'm also supposed to use for-loops.

    How would you have done this program the easiest way? I need some ideas, I'm a beginner in java programming and I have read some tutorials online but I just can't get this right!

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Arrays and for-loops??

    What have you tried?
    Without seeing that, for such a small program, it's going to be hard to say what you should do without actually giving you the answers.

    Your best bet is to break it down.
    1. You need to read in 5 numbers.
    2. Produce an average for 5 numbers.
    3. Find the largest of 5 numbers.

    There's three methods there (if you have done methods).
    Pick one and write that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Arrays and for-loops??

    Please don't use PMs to ask for help.
    That's what the forum is for.

    If you are having problems then at least try and write one of the three elements I mentioned in the above post.
    You could even break number 1 down into 2 parts...read in a single number, read in 5 numbers.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. For loops and arrays in reverse
    By Aimforthehead in forum New To Java
    Replies: 4
    Last Post: 10-17-2011, 05:49 PM
  2. Java Arrays & Loops
    By AdamG in forum New To Java
    Replies: 2
    Last Post: 10-14-2011, 05:14 PM
  3. How to use arrays and loops?
    By asadzarrar in forum New To Java
    Replies: 1
    Last Post: 10-31-2010, 11:04 PM
  4. A few questions about arrays and loops
    By Jamison5213 in forum New To Java
    Replies: 1
    Last Post: 12-22-2009, 05:59 AM
  5. Some problems with arrays and loops
    By BHCluster in forum New To Java
    Replies: 3
    Last Post: 04-16-2008, 12:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •