Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 23:00, Maya629277
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a. add symmetry b. create a unified publication c. provide consistency d. save money
Answers: 1
image
Computers and Technology, 24.06.2019 00:40, dheydar3506
What is the error in the following pseudocode? module main() call raisetopower(2, 1.5) end module module raisetopower(real value, integer power) declare real result set result = value^power display result end module
Answers: 1
image
Computers and Technology, 24.06.2019 00:50, JakeCline
Which of the following is not a key player in the sale of travel products?
Answers: 2
image
Computers and Technology, 24.06.2019 02:30, talia43
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
Do you know the correct answer?
Create a new java application called "weightedavgdataanalyzer" (without the quotation marks), that m...

Questions in other subjects: