Computer Science 220 Calculating Means Assignment

$25.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (5 votes)

Learning objectives:

  • Create a Python program on your own.
  • Develop a simple Python program that asks for input, does arithmetic, and provides output.
  • Practice definite loop
  • Apply the Software Development Process.

 

Assignment:

Applying the software development process will make implementing your solution easier.  Ask yourself, and write the answers to, questions 1-3 BEFORE implementing a solution in Python.  Your answers should be part of the comments at the top of your program.

 

  1. What will the program do?
  2. What will be the inputs and outputs?
  3. What is a step-by-step list of what the program must do, aka an algorithm? (Remember this is in English!)
  4. Implement your code.
  5. Test your program.

 

Programming problem:

The average of a set of numbers is often used in calculations.  We have seen during lecture how to calculate the most basic of means.  For this assignment, you are to write a Python a program designed to output the RMS (root-mean-square) Average and the Harmonic Mean.  These represent two different methods for calculating a mean of a set of numbers.

 

The average of a set of numbers, as discussed during lecture, is given by the formula:

 

 

The rms average of a series of numbers is the square root of the arithmetic mean of the squares of the numbers and is used by electrical engineers.  It is given by the formula:

 

The harmonic mean is often used when ratios are involved.  It is given by the formula:

 

Your code should allow the user to specify the number of values to be entered.  As a testing example, the values 10, 5, 2, and 5 have a rms average = 6.205 and a harmonic mean = 4.0.

 

Save your program as mean.py

File to be submitted:

mean.py

 

Submission instructions:

Log on to OAKS.  Click on the link to the dropbox for our class.  Upload your files into the folder for HW2.  Be sure to press the submit button.

 

Policies:

The policies given on OAKS are in effect for this and all assignments.