Finding the Mean and SD of values to xN

Posted on 2004-12-01
Last Modified: 2010-03-31
Suppose we have a set of values x1, x2, . . . , xN.
Write an application that calculates the mean and standard deviation of its command line arguments.
For example,
java MyApp 1 9 3 7
should produce output similar to:
For data: 1.0,9.0,3.0,7.0,
standard deviation=3.1622776601683795
Question by:MAragorn
    LVL 37

    Expert Comment

    We're not here/allowed to make your assignements.
    We're here to help you with *what you already have*
    LVL 13

    Expert Comment

    homework is prevented here, we can only provide tips and solve existing code problems

    Author Comment

    sorrry... i'll put in what i've worked out as soon as i write it up
    LVL 37

    Accepted Solution

    To make you familiar with command line arguments:
    - Start making a program that accepts some arguments
    - Let it print out those parameters.

    - Then parse those arguments as doubles
    - increment the sum (initially 0) with that double
    - divide the sum by the number of arguments to become the mean

    Author Comment

    thanks for your help... i managed to solve the mean but the SD was well hard
    LVL 37

    Expert Comment

    >> i managed to solve the mean but the SD was well hard
    Good to hear.
    Thanks for accepting

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now