![]() |
|
#1
|
|||
|
|||
HELP: ArraysSo I have an exam on Arrays this Friday in my programming class. I am trying to go through some homework problems but have had no luck. Therefore I decided to go over the example problems used in class which can help me solve the homework problems and study for the test. I don't really know how to go about these problems however. If anyone can explain how to arrive to the solution or show me the codes that would be extremely helpful and appreciated!
THANK YOU Given the following boolean array declaration, set each element of the array to alternating values (true at index 0, false at index 1, etc.) Code:
Given the following int array, write the appropriate Java code that will calculate and display the sum and the average of the values in the array: Code:
Given the following three int arrays, write the appropriate Java code that will copy the largest of the values at the same relative index position of list1 and list2 into the array largestValues. Then print all three arrays, the elements of the same index position for all three arrays on the same line. Code:
Given the following array of Strings, write the appropriate Java code that will print the total number of characters in the array, the average length of each element, and the longest element in the array. Code:
|
|||
|
#2
|
|||
|
|||
Re: HELP: ArraysQuote:
JAVA Code:
I'll let you try some of the other examples. If you have questions, tell us what you tried and tell us what went wrong and we'll probably be able to help some more. Good luck. |
|
#3
|
|||
|
|||
Re: HELP: ArraysHey guys thanks for your help I've solved all the problems except for the last one. Ive tried it so many times but If anyone can please help before my test I appreciate it thank you!!!
|
|
#4
|
|||
|
|||
Re: HELP: ArraysQuote:
JAVA Code:
|
|
#5
|
|||
|
|||
Re: HELP: Arrayshey fakepoo thank you so much for the help but how would I print out the longest element of that array and wouldn't that be the word "brillig"? How can I print that out
|
|
#6
|
|||
|
|||
Re: HELP: ArraysYou have the index of the longest element in LongestStringIndex so:
JAVA Code:
|
|
#7
|
|||
|
|||
Re: HELP: ArraysHey fakepoo funny thing LOL I meant the question before that I didnt do but for the array of strings problem I did have that question of how to print it out which u answered. What's the code for the one with array list1 and list2 .....
|
|
#8
|
|||
|
|||
Re: HELP: ArraysHere is how I would do it:
Loop from 0 to the largestValues.length-1. If list1[ loop index ] is greater than list2[ loop index ] then copy the value from list1 into largestValues. Otherwise copy the value from list2. I'll leave it to you to put it in java. |
Recent GIDBlog
New Corolla Altis, 10th Generation - Part I by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help with input files. | Efferus | CPP / C++ Forum | 2 | 24-Nov-2007 16:19 |
| Arrays as function arguments - return arrays from functions | pisuke | C Programming Language | 2 | 25-Jul-2007 11:03 |
| Dynamic vs Static Arrays | WaltP | Miscellaneous Programming Forum | 5 | 16-Feb-2006 15:54 |
| I am reviewing Arrays and need help converting some strings to arrays | jenmaz | C Programming Language | 22 | 22-Nov-2004 23:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The