In the following, write all loops so they would still work if the sizes of the arrays were changed. (You need not get values from the user for the following; you can just make up values in the code. However, your code should still work if those values wer

computer science

Description

In the following, write all loops so they would still work if the sizes of the arrays were changed. (You need not get values from the user for the following; you can just make up values in the code. However, your code should still work if those values were changed.) In a project, in a main, create an array of doubles of length 10, and give it values using special initialization. Then write a loop that goes through the array, and after the loop report the largest and smallest number in the array, and the average of all the numbers. [Extra Credit+5] also report the second largest. In the same main, create an array of 10 strings. Using nested loops, fill it with values so that each element is a string containing a number of x's based on the index, so the 0th element is "", the 1st element is "x" the 2nd element is "xx", and the 9th element is "xxxxxxxxx". (hint, one loop will move you through the array, the other will add the right number of x's to the current element). 


In the same main, create an array of 10 booleans called printIt and and array of 10 strings called words, both using special initalization. Then go through the words array and print each element of words only if the printIt array in the same position is true. You DO NOT need a nested loop for each array (think about the parallel arrays). In the same main, create an array of 10 ints called howManyTimes using special initalization. Then go through the words array (again) and print each element of words the number of times given in howManyTimes. So if howManyTimes[3] is 9 and words[3] is "hello" you would print "hello" 9 times. To do this you will need nested loops: an outer loop to move through the arrays, and an inner loop to print the words the right number of times. You DO NOT need a nested loop for each array (think about the parallel arrays). [Extra Credit+5] change the loop you just wrote so that for each element you print the words howManyTimes only if printIt is true, and otherwise print "[THIS WORD REMOVED]" once.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.