Results 1 to 3 of 3
Thread: programming homework
- 04-14-2009, 08:08 PM #1Member
- Join Date
- Feb 2009
- Rep Power
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];
- 04-14-2009, 08:17 PM #2
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.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
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!
- By pinkdiamondgail in forum Advanced JavaReplies: 7Last Post: 04-07-2009, 01:34 AM
- By excurssion in forum New To JavaReplies: 2Last Post: 10-17-2008, 06:00 AM
- By robrobrob in forum New To JavaReplies: 4Last Post: 10-17-2008, 04:24 AM
- By JavaNewbie0000 in forum New To JavaReplies: 2Last Post: 07-31-2008, 03:06 PM
- By alcohole4life in forum New To JavaReplies: 1Last Post: 05-23-2008, 04:18 PM