Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Java please The first class, NumberArraystatistics, needs to store an array of doubles as its instance variable. You should create three constructors for this

Use Java please image text in transcribed
The first class, NumberArraystatistics, needs to store an array of doubles as its instance variable. You should create three constructors for this class: a default constructor that creates an array of 5 default double values, a parameter constructor that accepts an array of doubles, and a parameter constructor that accepts an integer value, representing the length of the array, and creates an array based on that number. You will need to complete the following methods in the NumberArraystatistics class (you may assume that the instance variable array is not empty when writing these methods): - addAt Index - accepts two parameters: a double value to be added to the array and an index of where in that array should be located. The method will add the double value at that index (replacing what was already there not shifting!), and return nothing. - tostring - returns a String with the array contents in the form {1.0,4.0,5.0}. Note that there is a comma then a single space between each pair of elements, but there are no spaces/commas at the start/end, only curly braces. Make sure it has this form exactly. Note: Decimals do not have to be formatted to one decimal. - average - returns the arithmetic mean average of the numbers in the array as a double. This is found by dividing the sum of the numbers by the amount of numbers in the array (note: some values returned may be slightly inaccurate due to roundoff errors, but you do not have to worry about this right now). - range - returns a double found by subtracting the smallest number in the array from the largest number in the array. Note that the smallest and largest value could be anywhere in the array, not in the first and last positions. - SortStatus - returns an int which is equal to 1 if the array is sorted in increasing order (every number is greater than or equal to the previous number) 1 if it is sorted in decreasing order (every element is less than or equal to the previous number) 0 if it is not sorted If every element in the array is the same, then it is counted as being in increasing order

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago