Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Rep Power

    Default programming homework

    can someone help me put these codes into a program? I missed a couple of classes and I don't know where to begin, if someone could start me off.

    1. for (int count = 0; count < nums.length; count++)
    nums[count] = INITIAL;
    2.for (int count = names.length - 1; count >= 0; count--)

    3.for (int index = 0; index < flags.length; index++)
    flags[index] = (index%2 == 0);
    4.public static float sumArray (float[] nums)
    float sum = 0;
    for (int count = 0; count < nums.length; count++)
    sum += nums[count];
    return sum;

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Rep Power


    You need to know what the program is supposed to do. Otherwise, it's just guessing. I can tell what each thing is doing:

    1. Filling up an array called nums with the value of a constant called INITIAL
    2. Printing to screen the contents of an array called names
    3. Filling up an array with boolean values if index is even
    4. A method that sums the elements of an array passed as the method's parameter.

    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    much better would be for you to try to start creating the program yourself and then come back if you have a specific question regarding your code. Also, try to get up with your teacher so you can get caught up fast. Programming is like math: if you miss studying some of the basics, you'll never be able to understand the more advanced stuff.

    This tutorial may be able to help you in your studies:
    Sun Java Tutorial
    Best of luck!

Similar Threads

  1. help with homework
    By pinkdiamondgail in forum Advanced Java
    Replies: 7
    Last Post: 04-07-2009, 01:34 AM
  2. LF: Homework help with Java
    By excurssion in forum New To Java
    Replies: 2
    Last Post: 10-17-2008, 06:00 AM
  3. Homework help...
    By robrobrob in forum New To Java
    Replies: 4
    Last Post: 10-17-2008, 04:24 AM
  4. Need help with homework.
    By JavaNewbie0000 in forum New To Java
    Replies: 2
    Last Post: 07-31-2008, 03:06 PM
  5. Some input on a homework
    By alcohole4life in forum New To Java
    Replies: 1
    Last Post: 05-23-2008, 04:18 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