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
Related Q & A:
- How to Implement Gateway Service something similar to Oracle API gateway Using Java and Java based Open Source frameworks only?Best solution by Quora
- I need help with writing up the Java Code.Best solution by Yahoo! Answers
- How hard will AP computer science if I have no past knowledge of programing or Java?Best solution by Yahoo! Answers
- Difference between Java 2 and Java 6?Best solution by Yahoo! Answers
- What is the different between low level language and high level language in a computer programing?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.