Home Answers Viewqa Java-Beginners Standard deviation

 
 


Supriya Kurian
Standard deviation
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

program to calculate the standard deviation of an array of values.the array elements are read from terminal.use function to calculate standard deviation and mean.

View Answers

December 10, 2010 at 1:39 PM


Hi Friend,

Try the following code:

import java.util.*;

public class StandardDeviation{
        public double findMean(int array[]){
        double total = 0;
        for(int i = 0; i < array.length; i++){
            total = total + array[i];
        }
        double mean = total/array.length;
        return mean;
    }
      public void findStandardDeviation(int array[]){
        double mean = findMean(array);
        System.out.println("Mean is: "+mean);
        double d1 = 0;
        double d2 = 0;
        double sum = 0;
            for(int i = 0; i < array.length; i++){
                d2 = (mean - array[i])*(mean - array[i]);
                d1 = d2 + d1;
            }
        System.out.println("Standard Deviation: " + Math.sqrt((d1/(array.length-1))));
            }

    public static void main(String args[]){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Array Elements: ");
        int array[] = new int[5];
        for(int i=0;i<array.length;i++){
            array[i]=input.nextInt();
        }
        StandardDeviation sd = new StandardDeviation();
        sd.findStandardDeviation(array);
        }
}

Thanks









Related Pages:
Standard deviation
Standard deviation  program to calculate the standard deviation of an array of values.the array elements are read from terminal.use function to calculate standard deviation and mean
standard format in C++
standard format in C++  Please help me with this one. thank you so much. **"Write a C++ program to read a date in US standard format (mm dd yyyy) and print it in Australia standard format (dd mm yyyy
spring standard tag libraries
spring standard tag libraries  hello sir please tell me how to write the jsp in Spring frame work using spring standard tag libraries
Joomla Standard Package
Joomla Standard Package In this package we offer a complete standard package that can be customize or upgraded later as per the requirement of the clients. The client itself can modify and manage
standard action - JSP-Servlet
standard action  Any one please tell me what is the function of standard actions tags and the deatils of its atrributes along with example. ... or a standard tag. For Example : Action may display an output or write some value
the standard isolation levels defined by JDBC
the standard isolation levels defined by JDBC  What are the standard isolation levels defined by JDBC
Replace JSF Standard Error Message
Replace JSF Standard Error Message  How can we replace the JSF Standard Error Message
Java 2 SDK, Standard Edition,
Java 2 SDK, Standard Edition,  Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database
java standard edition - Java Beginners
java standard edition  good evening sir. i want to install j2se version-6 on my laptop and netbeans, so i want to know the path: and classpath: to type in the environmental variables Dialogue box. also full details about
JSP Standard Actions
JSP Standard Actions In this section, we will learn about JSP standard Action & their elements with some examples. JSP Standard action are predefined..., to generate a browser-specific code, etc. The JSP standard actions affect the overall
Standard Action "jsp:param"
Standard Action <jsp:param> In this Section, we will discuss about "jsp:param" standard action & their utilization with a example. Basically, <jsp:param> is use to pass one or more name/value pairs as request
Command Line Standard Output In Java
Command Line Standard Output In Java In this section we will discuss about the Command Line Java IO Standard Output. Standard streams, feature of various O/S, are written through standard output in Java. Standard streams can
Java Standard Edition
Java Standard Edition Java, Standard Edition also called Java SE is commonly... standard edition comprise of a virtual machine, which is put in practice for running... different applications. Before getting its present name Java Standard Edition 6.0
Command Line Standard Error In Java
Command Line Standard Error In Java In this section we will discuss about the Command Line Java IO Standard Error. System.out and System.err both are for Standard output but, System.err separates the error output. System.err
how to parse a csv file using standard libraries?
how to parse a csv file using standard libraries?  hie i am a beginner in java i want to parse a csv file using any standard libraries i want to know how the libraries are imported and used in eclipse thanks in advance
Standard Action "jsp:plugin"
Standard Action <jsp:plugin> In this Section, we will discuss about standard action "jsp:plugin" & their implementation using a example...:plugin>' standard action. pluginstandardaction.jsp <
Standard Edition Networked Application - Java Beginners
Standard Edition Networked Application   I Develope a School Automated System on standard edition that takes a details from the user interface and deposited into the database (MSSQL), i make the registrar to be able to upload
Standard Edition Networked Application - Java Beginners
Standard Edition Networked Application   I Develope a School Automated System on standard edition that takes a details from the user interface and deposited into the database (MSSQL), i make the registrar to be able to upload
Command Line Standard Input In Java
Command Line Standard Input In Java In this section we will discuss about the Java IO Standard Input through Command Line. Standard streams, feature of various O/S, are read through standard input in Java. Standard streams are read
Read Text from Standard IO
Reading Text from the Standard Input       Standard Streams: Standard Streams... operations on files.  Java also supports three Standard Streams
Fetch the data using jsp standard action
Fetch the data using jsp standard action  I want the code of fetch the data from the database & show in a jsp page using jsp:usebean in MVC model 2 architecture. Suppose after login a user can view his/her details which he
JSP Standard Action 'jsp:useBean'
JSP Standard Action <jsp:useBean> This action let you use java bean... STANDARD ACTION</strong></h3> </td> </tr>... standard Actions :<jsp:setProperty> & <jsp:getProperty>
JSP Standard Tag Libraries (JSTL)
JSP Standard Tag Libraries (JSTL)       JSTL is developed under the Java Community Process... and standard set of custom tags. It encapsulates simple tags as the common core
use JDBC to execute non-standard features that my DBMS provides.
use JDBC to execute non-standard features that my DBMS provides.  Can I use JDBC to execute non-standard features that my DBMS provides
JSP Standard Actions 'jsp:setProperty' & 'jsp:getProperty'
JSP Standard Actions <jsp:setProperty> & <jsp:getProperty>..., boolean, Boolean, byte, Byte, char, and Character via the standard valueOf...; <h3><strong>EXAMPLE OF JSP:USEBEAN STANDARD ACTION<
Write Log Records to Standard Error in Java
Write Log Records to Standard Error in Java   ... to standard error in Java. Java provides the facility for handling an error... or publishes log records on the standard error which is written in the log file
Need the program urgent veryyyyyyyyyyyyy urgent plsssssssssssssssssss follow the standard in the program
Need the program urgent very urgent please follow the standard in the program  Restaurant Order Management System (ROMS) Problem Case: Create a ROMS system, which is intended to take an order from the customer and charge
retrieving image from mysql db with standard height and width
retrieving image from mysql db with standard height and width  Hi . Here is my code to retrieve an image from mysql db. Its working properly. But i want the image with specified width and height. How to specify it in this code
retrieving image from mysql db with standard height and width
retrieving image from mysql db with standard height and width  Hi . Here is my code to retrieve an image from mysql db. Its working properly. But i want the image with specified width and height. How to specify it in this code
Standard JDK Tools
Standard JDK Tools Basic Tools Tool Name Brief Description javac  This is the core of java, the compiler for the Java... applications that use OMG-standard IDL and CORBA/IIOP. Tool Name 
Using Standard Validator & Custom Validator
Using Standard Validator & Custom Validator... address is in correct format etc. You can implement it using standard validators supplied by JSF or by creating your own custom validators.   Standard
Using Standard Converter & Custom Converter
Using Standard Converter & Custom Converter          Convertors... format. Using the Standard Converters: JSF provides standard converters for all
JSF Interview Questions
: JSF standard Converters JSF supplies built-in converters known as standard converters. All standard... standard converters have their own tags? DateTimeConverter and NumberConverter
A program solution needed
of the middle two grades. · The standard deviation, calculated as: standard deviation
MySQL Aggregate Function
standard deviation STDDEV_SAMP() It Return the sample standard deviation STDDEV() It Return the population standard deviation SUM() It Return
SEMISTER
are required to compute summary statistics (mean and standard deviation) for each... 15 20 The following are the formulae for mean and standard deviation... to compute the standard deviation). ? If you think they are needed, you may
Buttons
Java: Buttons There are many kinds of buttons, all derived from the AbstractButton class. ComponentsDescription JButton This is a standard button which can have text, icon, or both. Listener: addActionListener
Java Gregorialcalendar
Java Gregorialcalendar         Java provides the standard calendar by providing the class GregorianCalendar in java.util package. The Gregorian calendar is used in most countries
EJB directory structure
; The tutorial is going to explain the standard directory structure of an EJB... which provides meta-information for the JAR. This file is a standard component... given is the standard directory structure of the Enterprise Java Bean application
What is WiFi?
the 802.11 standard. The term WiFi is an abbreviation of ‘wireless..., the radios operating at 802.11a standard can transmit at 5GHz. Another important... used. The 802.11a and 802.11g standard radios use Orthogonal Frequency-Division
XML DOM Tutorial
XML DOM Tutorial       W3C provides a standard called DOM (Document Object Model) for HTML & XML documents. DOM is also used as an interface for accessing and manipulating HTML & XML
Comparison Operators
Java NotesComparison Operators All the standard comparison operators work for primitive values (int, double, char, ...). The == and != operators can be used to compare object references, but see Comparing Objects for how to compare
ADL
ADL       ADL Pack series is the extension package for Joyistar WebShop with more powerful function and beautiful UI. And also it's the standard AJAX library. Read full Description
Chart Effect in Flex4
Chart Effect in Flex4: Chart uses the standard Flex effect like Zoom and Fade. There are some standard effect for chart series which is: SeriesInterpolate, SeriesSlide, SeriesZoom. These classes uses the mx.charts.effects.effects
Java Technology on Linux
; Java technology supports Java Platform, Java Standard Edition, Java... and desktops for the Linux.Java technology makes available Java 2 Platform Standard... Configurations Java Platform, Standard Edition 5.0 Java 2 Platform
AdvancedDataGrid Control in Flex4
AdvancedDataGrid control in Flex4: The AdvancedDataGrid control is same as a DataGrid control. It has a functionality of the standard DataGrid control. It provides the good control of data display and data formatting. You can provide
JSF Features
of standard features that makes it a powerful and standard among the existing.... JSF is standard web user interface framework for Java. Built on top
JavaBeans Activation Framework
;  Java Activation Framework, or JAF, is a standard extension to the Java platform that lets the developers take advantage of standard services..., Standard Edition (J2SE).    
Implementing WS-Security
WS-Security standard was used to secure a Web service that was developed...; The WS-Security Standard Clearly an industry standard way of securing

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.