How does Increment operator work in Java?

Java Programing Help?

  • I had a assignment due on this project im working on Write a program to * prompt for a file name * read a set of doubles from the file * calculate and report n, the mean, and the population standard deviation. Format the mean and standard deviation to two decimal places. This is what he says the basic outline should look like: Basic outline for the program // prompt for input file //while (data remains) { // input number // increment n // accumulate sum of number // accumulate sumsquares: sum of number^2 // } // calculate and display n, mean, standard deviation To calculate the standard deviation use: \sqrt{N \sum x^2 -(\sum x)^2 \over N ^2} I have worked on it some and this is what i have....I do not know what i need to do to get it to work.... package statistics; import java.io.File; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner keyboard = new Scanner(System.in); System.out.print("Enter the name of a file: "); String filename = keyboard.nextLine(); File file = new File("Numbers.txt"); Scanner inputeFile = new Scanner(file); while (inputFile.hasNext()){ double n = 0; double sum = 0.0; sum = sum + n; System.out.println("The sum of " + n + " Numbers is: "+ sum); System.out.println("The Average is: " + sum/n); } } } This is an example of the Results it should look like: The sum of the 5 numbers in Numbers.txt is 41.40 average is 8.28 standard deviation 3.09

  • Answer:

dirtboy4... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.