Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this assignment to enter by reading them as user input set of numbers and store them in variable array size. If the

The goal of this assignment to enter by reading them as user input set of numbers and store them in variable array size. If the input value equal 0 then no more inputs and the program will print out number of input values, maximum value, minimum value, mean (average), and standard deviation (as shown in test run file which are existing in the same assignment folder).

This assignment will let the students using arrays, the `while` loop, and keyboard input using the `Scanner` class.

#### Step 1: Determine what data needs to be stored in the `DataSet` class

1. Study the sample output files. (Existing in the same folder)

- [TestRun1.txt](TestRun1.txt)

- [TestRun2.txt](TestRun2.txt)

- [TestRun3.txt](TestRun3.txt)

- [TestRun4.txt](TestRun4.txt)

- [TestRun5.txt](TestRun5.txt)

2. Study the formula for Standard Deviation.(PNG File is existing in the same folder)

* n represents the total number of values

* x represents your set of values

* x represents the average of all the values in the set. Average is summation of all the set values divided by the total number of the values.

* s :represents standard deviation

3. Determine what attributes the `DataSet` class needs to store.

- The `DataSet` class will store the numbers in an array. You will have to use an array that is larger than the largest number if inputs you expect the user to enter.

- What other attribute(s) do you think you will need? Not all of the outputs need an attribute - most of them will be calculated as needed.

#### Step 2: Design the methods for the `DataSet` class

1. There is no need for a constructor in this class. You can use Java's default constructor which initializes all the instance variables to 0.

2. The other methods that your `DataSet` class must provide are below. What parameters (if any) do each of the methods need and what are their return values (if any)?

- `add`

- `getAverage`

- `getStandardDeviation`

- `getMax`

- `getMin`

- `toString`

3. Write the method header for each of them.

#### Step 3: Implement and test the `DataSet` class

1. Create the `DataSet` class. Write the Javadoc comment for the class.

2. Add the attributes you decided on in Step 1.3.

3. Implement the `add` method you designed in Step 2.3.

- Write the JavaDoc comment for the method.

4. You can test the `add` method in jGrasp by creating a new `DataSet` object, and calling the `add` method to add a few numbers. Inspect the contents of the object to determine if your add method works correctly.

5. Implement the `getAverage` method you designed in Step 2.3.

- Write the JavaDoc comment for the method.

6. Implement the `getMax` method you designed in Step 2.3.

- Write the JavaDoc comment for the method.

7. Implement the `getMin` method you designed in Step 2.3.

- Write the JavaDoc comment for the method.

8. Implement the `getStandardDeviation` method you designed in Step 2.3.

- Write the JavaDoc comment for the method.

9. Implement the `toString` method you designed in Step 2.3.

- The `String` generated should produce the output of all the lines following the `Please enter a value: 0` in the test runs.

- You will have to use the `format()` method of the `String` class to format the mean and standard deviation.

- Write the JavaDoc comment for the method.

#### Step 4: `ArraysAssignmnet` Class

Design a class called ` ArraysAssignmnet ` which will be the driver module — it has one method `main` where you prompt the user to enter values. Use a `while` loop with 0 as the sentinel value. Then it will print out the `String` representation of the `DataSet` object.

Several runs of the program are given. Test your code to make sure it works for all inputs as shown in the output files

### 5. Clean Up Your Code Before Submitting

Once you've completed your implementation, and all of tests pass, you are done.

Go back through the source code of your `DataSet` class and be sure:

1. The class has a comment at the top with an accurate description

2. The class' comment reflects the authors and version.

3. Each method has an accurate comment with `@param` and `@return` where needed with appropriate descriptions.

Test run 1

Please enter a value: 56 Please enter a value: 90 Please enter a value: 3 Please enter a value: 11 Please enter a value: 94 Please enter a value: 59 Please enter a value: 66 Please enter a value: 29 Please enter a value: 50 Please enter a value: 0 You entered 9 number(s) Mean of all values you entered is: 50.89 Standard deviation of all values you entered is: 31.77 The maximum value is: 94 The minimum value is: 3

test run 2

Please enter a value: 0 You did not enter any number(s)

test run 3

Please enter a value: 33 Please enter a value: 0 You entered 1 number(s) Mean of all values you entered is: 33.00 Standard deviation of all values you entered is: 0.00 The maximum value is: 33 The minimum value is: 33

test run 4

Please enter a value: 11 Please enter a value: 22 Please enter a value: 33 Please enter a value: 44 Please enter a value: 12 Please enter a value: 24 Please enter a value: 36 Please enter a value: 48 Please enter a value: 60 Please enter a value: 55 Please enter a value: 0 You entered 10 number(s) Mean of all values you entered is: 34.50 Standard deviation of all values you entered is: 17.23 The maximum value is: 60 The minimum value is: 11

test run 5

Please enter a value: 12 Please enter a value: 12 Please enter a value: 12 Please enter a value: 12 Please enter a value: 0 You entered 4 number(s) Mean of all values you entered is: 12.00 Standard deviation of all values you entered is: 0.00 The maximum value is: 12 The minimum value is: 12 image text in transcribed

s=n1i=1n(xix)2

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions