Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is Ruby Language Problem. Directions: Please complete the following assignm

ID: 3684864 • Letter: T

Question

This is Ruby Language Problem.

Directions:

Please complete the following assignment to signify your completion of Unit 7. All programming projects need to be completed and submitted electronically, following the Electronic Submission Guidelines discussed in class.

Background:

The purpose of this assignment is to get practice working with arrays. In Ruby, arrays are very powerful and ever-present, it seems. The programming project below will ask you to learn some of these new capabilities.

Project 1: Math Calculator
Create a Ruby program which reads numbers, deposits them into an array and then calculates the arithmetic mean (otherwise known as the average), the median (that is, the number that splits the set of value in half with half being above and half being below the number), and the standard deviation (that is, the average of distance each number is from the mean then squared). Further information about these calculations can be found here:

average: http://en.wikipedia.org/wiki/Average
(add up all the numbers in the set and divide that total by the quantity of values in the set)

median: http://en.wikipedia.org/wiki/Median
(for a set that holds an odd number of values, sort the numbers in the set and then take the value in the middle of the set. for a set that holds an even number of values, sort the numbers in the set and find the average of the two values in the middle of the set).

standard deviation: http://en.wikipedia.org/wiki/Standard_deviation
(find the average of the set. for each value in the set, calculate the difference between each value and the average. square each of these difference. find the average of these squared differences. take the square root of this average).

IN ORDER TO RECEIVE FULL CREDIT, YOUR CODE SHOULD PROPERLY READ VALUES, STORE THEM IN AN ARRAY AND MANIPULATE THE ARRAY TO ARRIVE AT THE DESIRED CALCULATIONS.

Hint : In order to have Ruby calculate the square root of a numeric value named i, please say squareRootOfI = Math::sqrt( i )

A number of different program dialogues describe the program I am looking for.

Math Calculator
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: N
2 4 4 4 5 5 7 9
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: A
Average = 5.0
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: M
Median = 4.5
N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: S
Standard Deviation = 2.0
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: C
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: N
4 4 4 6

[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: N
6 3 1

[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: A
Average = 4.0
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: M
Median = 4
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: S
Standard Deviation = 1.603
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: Q

Explanation / Answer

sample output:

[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: N
2 4 4 4 5 5 7 9
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: A
Average = 5.0
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: M
Median = 4.5
N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: S
Standard Deviation = 2.0
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: C
[N]umbers [A]verage [M]edian [S]tandard Deviation [C]lear [Q]uit: N
4 4 4 6

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote