subject

Create a new java application called "weightedavgdataanalyzer" (without the quotation marks), that modifies the dataanalyzer. java in horstmann section 7.5, pp. 350-351 according to the specifications below.
the input file should be called 'data. txt' and should be created according to the highlighted instructions below. note that even though you know the name of the input file, you should not hard-code this name into your program. instead, prompt the user for the name of the input file.
the input file should contain (in order): the weight (a number greater than zero and less than or equal to 1), the number, n, of lowest numbers to drop, and the numbers to be averaged after dropping the lowest n values.
you should also prompt the user for the name of the output file, and then print your results to an output file with the name that the user specified.
your program should allow the user to re-enter the input file name if one or more of the exceptions in the catch clauses are caught.
your methods for getting data and printing results should each throw a filenotfoundexception which should be caught in the main method.
use try-with-resources statements (links to an external site.)links to an external site. in your methods for getting and printing the data, and so avoid the need to explicitly close certain resources.
in your readdata method, use hasnextdouble to check ahead of time whether there's a double in the data. that way when you try to get the nextdouble, your code won't throw a nosuchelementexception.
you can use a writefile method that does all the work (i. e., does not call a writedata method the way that horstmann’s readfile method calls a readdata method). use a try-with-resources statement in your writefile method when creating a new printwriter.
the inputvalues come from a single line in a text file (data. txt) such as the following:
0.5 3 10 70 90 80 20
the output in the output file must give the weighted average, the data and weight that were used to calculate the weighted average, and the number of values dropped before the weighted average was calculated.
your output should look very much like the following: "the weighted average of the numbers is 42.5, when using the data 10.0, 70.0, 90.0, 80.0, 20.0, where 0.5 is the weight used, and the average is computed after dropping the lowest 3 values."
write the output to a file with the filename that the user chose to name the output file (e. g., output. txt). don't hard-code the output file name in your program.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 24.06.2019 19:30
Can someone who is skilled at coding create me a java chess game. don't copy from online source codes. make it original ! : d
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
Systolic pressure is a measure of blood pressure when the ventricles relax and fil with blood ture or false
Answers: 1
question
Computers and Technology, 25.06.2019 06:00
Shaniya has misspelled a scientific name in her biology report. she needs to correct it, but she has no access to a computer. she plans to use the word app on her phone without an office 365 subscription. can shaniya correct her mistake? why or why not? yes, she can navigate the window and do simple editing. yes, she can use this application for free and navigate the window. no, her document is “read-only,” so she cannot navigate the window. no, her application has limited features and she cannot access the documen
Answers: 1
You know the right answer?
Create a new java application called "weightedavgdataanalyzer" (without the quotation marks), that m...
Questions
question
Mathematics, 04.12.2020 21:10
question
World Languages, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
question
Mathematics, 04.12.2020 21:10
Questions on the website: 13722362