Question: 1. (5 pts) Within a class named Sum, write a program that allows the user to enter 5 int values and stores them into an

1. (5 pts) Within a class named Sum, write a program that allows the user to enter 5 int values and stores them into an array. Your program should then compute and display the alternating sum of those 5 elements. For example, in an array that contains (1,8, 9, -3, 4), the alternating sum would be computed as 1 -8+9-(-3) +4 9, Note that the array length is fixed at 5 for this problem. However, your code should be written such that it works for an array of any length, simply by changing the length used during array instantiation. (7 pts) Many people who play combat-based games like to look at statistics about their characters. Within a class named CombatStats, write a program that allows the user to enter a set of double values into an array, representing the damage done by a number of attacks in a game. The program should begin by allowing the user to specify the quantity of values to enter. Once all the values have been stored into the array, your program should compute and display the minimum, maximum, and average values that were entered. 2. Hints: To find the minimum element, start by assuming that the element at index 0 is the minimum. Check the other array elements one at a time. If any of them are less than the minimum, update the minimum to be that element. The algorithm to find the maximum element is almost identical to the one above. . . To find the average, add up all the elements in the array and divide by the quantity of elements (i.e., the array's length)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
