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 19:20
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
question
Computers and Technology, 23.06.2019 02:50
Define a class named movie. include private fields for the title,year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie.write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields.this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie.settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie.setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie.setdirector(temp); //display all the data myfavoritemovie.displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie.cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
You know the right answer?
Create a new java application called "weightedavgdataanalyzer" (without the quotation marks), that m...
Questions
question
Mathematics, 04.07.2019 21:30
question
Mathematics, 04.07.2019 21:30
Questions on the website: 13722360