Writing two codes in Java, homework help

User Generated

WGbeerf16

Other

Description

Hello,

I have an assignment which is doing writing two codes in java. Please follow the exact instructions of the assignment.

I will provide you the required programs to be done.


First code:

Mean and Standard Deviation

Write a program that prompts the user for 10 floating point values. The program should invoke two methods to calculate the mean and standard deviation of the numbers. You can use the formula below to calculate the mean and standard deviations.


You will need:

A scanner object to read the 10 values

An array to store the ten values

Two methods that do the following:

Accepts an array and returns the mean

Accepts an array and returns the standard deviation

Comments where necessary


A sample of the output is shown below:

Enter ten numbers: 1.9 2.5 3.7 2 1 6 3 4 5 2

The mean is 3.1100000000000003

The standard deviation is 1.5573838462127583

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Second code:

Sum of two matrices

Write a program that accepts two 3 x 3 matrices and invokes a method to add them together. The formula for adding two matrices is shown below:



You will need:

A scanner object to read the values that fill the arrays

Three 2-dimensional arrays:

One to store the values in the first 3x3 matrix

One to store the values in the second 3x3 matrix

One to store the sum of the values from the first two matrices

A method that adds the two matrices using the formula above

Comments where necessary


A sample of the output is shown below:

Enter matrix1: 1 2 3 4 5 6 7 8 9

Enter matrix2: 1 2 3 4 5 6 7 8 9

The addition of the matrices is

1.0 2.0 3.0 1.0 2.0 3.0 2.0 4.0 6.0

4.0 5.0 6.0 + 4.0 5.0 6.0 = 8.0 10.0 12.0

7.0 8.0 9.0 7.0 8.0 9.0 14.0 16.0 18.0

Tip: You may prefer to print the results out this way instead:

Enter matrix1: 1 2 3 4 5 6 7 8 9

Enter matrix2: 1 2 3 4 5 6 7 8 9

The addition of the matrices is

1.0 2.0 3.0

4.0 5.0 6.0

7.0 8.0 9.0

+

1.0 2.0 3.0

4.0 5.0 6.0

7.0 8.0 9.0

=

2.0 4.0 6.0

8.0 10.0 12.0

14.0 16.0 18.0


User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hello buddy, i have f...


Anonymous
Just what I was looking for! Super helpful.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags