Write a function which accepts an array of doubles and its length as parameters and returns the sum of all positive values less than 24 within the array: for example, if the array contains 5, 8.3, 29, -2 and 7, the function will return the value 20.3 (=5 + 8.3 + 7). In addition to this, write a main method which populates an array with random values, passes the array and its length to the function and outputs the returned value to the screen.
Write a program which asks the user to press one of the keys r, g, b or x. If the user enters an r, g or b output one space with the associated colour (red, green or blue). If the user enters x, the program should terminate.
In the first function you speak of, you need to
1) keep a sum total which is initialized to 0
2) walk through the array
3) for each value, check if(array[i] < 24 && array[i] > 0)
4) if the value meets those requirements then add them to sum.
Read the top thread in this forum. We will not do your homework for you. We WILL help anyone who shows an effort and tries to figure it out for themselves first. An attitude like that is a primary key to success in programming. It's all about figuring things out by doing research (not asking for solutions on a forum).
So, post the code you have so far...
Also, start TWO threads for your two problems (preferably ONE AT A TIME). Trying to help you with two problems in the same thread will be very confusing.