+1 (208) 254-6996 [email protected]
  

Please check the attachment

CSCI 1011 Java Programming Fall 2019 Summary Statistics Assignment This is not a group project. Do your own work. Giving a solution to a student is as dishonest as getting a solution from anyone else. The objective of this assignment is for the student to gain experience with a user-defined data type, which includes work with an array, a class, a member variable, and member functions, including a constructor. Loops and if() statements are also needed. This assignment is worth 100 points, or 12.5% of your final grade. A solution which fails to compile will receive

Don't use plagiarized sources. Get Your Custom Essay on
Urgent 2
Just from $13/Page
Order Essay

no more than half credit. Code which fails to run to a normal termination will receive no more than 2/3 credit. Write a class named SummaryStatistics, which of course means that the file name must be SummaryStatistics.java. Required elements:

1. A private member variable for an array of type long. This is a reference variable that I will call “v” in the rest of this assignment.

2. A constructor that accepts a reference to an array of type int. Copy the elements from the int array into a new long array (hereafter referred to as v). Store the long array reference in your private member variable from requirement #1.

3. A function named getAverage(), which accepts no arguments and returns a float value that is the average of the elements in the v array. Watch out for decimal truncation!

4. A function named getRange(), which accepts no arguments, which returns a long value, which is the range of the elements in v. Hint: The easy way to do this is to use two of the other functions.

5. A function named getMaximum(), which accepts no arguments and returns the value of the largest element in v. Pick the most appropriate return type.

6. A function named getMinimum(), which accepts no arguments and returns the value of the smallest element in the array. Pick the most appropriate return type.

7. A function named getMidrange(), which accepts no arguments, computes the midrange of the values in the array v, and returns that computed midrange. Pick the most appropriate return type.

8. A function named getValueAt(), which accepts an integer argument and returns the value at that index in the array. Pick the most appropriate return type.

9. A function named setValueAt(), which accepts an long argument and an int argument: the new value to store, and the index in the array at which to store the new value, in that order. Pick the most appropriate return type.

10. A function named getSum(), which accepts no arguments and returns the sum of the values in the array. Pick the most appropriate return type.

All functions must be public and non-static. Common pitfalls for which you will lose points if your solution contains these errors:

• This is a class (user defined data type) and every function must use the data in the v array. It is 100% incorrect to have any static elements. You will lose points for every instance of the word “static” in your code. This means you may NOT include a main() function because it is not needed.

• This is a class that calculates statistics. There is no need for any print statements. Your job is to compute numbers, not to print them. You will lose points if your code prints anything at all.

• Hard-coding numbers in an array is a dead giveaway that you don’t understand the purpose of this assignment. Your code should be able to handle ANY arbitrary int array that I use for testing. If you hard-code an array of values, then your code can handle one, and only one, set of numbers and your solution will only handle that specific set of numbers. The test harness provides the array of numbers. Your code must not provide any hard-coded set of numbers.

• Failure to follow instructions. Students make preventable mistakes; don’t be one of those students. Read and follow the instructions.

• Poor formatting. This is a sign of sloppiness and the beginning of a bad habit. Always take the time to format your code, using indentation and helpful variable names.

Order your essay today and save 10% with the discount code ESSAYHELP