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.

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions