Computers and Technology
Computers and Technology, 16.08.2021 22:50, vzimokha

Create a new Java application called "WeightedAvgDataAnalyzer" (without the quotation marks), that modifies the DataAnalyzer. java code above 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. Creating the Input File To create the input file, while in NetBeans with your project open, first click to highlight the top-level folder of your project, which should be called WeightedAvgDataAnalyzer. Then from the File menu do this: File->New File Keep the Project name at the top; keep Filter blank Categories choose Other (at the bottom of the categories list) File Types choose Empty File (at the bottom of the files list) Next-> FileName: data. txt Folder: this should be blank; if it's not, delete whatever's there. Finish In the empty file data. txt that you just created, add a single line of data like that shown in the example above, where the weight is a double (greater than 0.0 and less than or equal to 1.0) and the other numbers are the number, n, of lowest values to drop and then the numbers to be averaged after dropping the lowest n values. Then save this data. txt input file. It's important that your input file is where NetBeans will look to find it. The above instructions should make sure that that happens.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:20, sharperenae463
What do you need to know & understand about global expansion.
Answers: 2
image
Computers and Technology, 22.06.2019 01:00, keasiabradley
Search the web for two examples of digital art that you like. the examples must be from different mediums (example: one digital photo and one computer animation not two computer animations). compose an essay for each example you choose about why the piece appeals to you, and identify the medium used.
Answers: 1
image
Computers and Technology, 22.06.2019 17:00, hollodom9654
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, destinyd10189
Read the following scenario, and then answer the question below. you want to send an e-mail to your boss requesting a meeting to discuss a raise. what is the best example of an e-mail to an employer about this meeting? ā€œhey jason. can we chat about getting me more money soon? let me know. peace, meg.ā€ ā€œhello jason. pardon me for sending yet another e-mail today about my need to talk to you about my position and a possible pay increase. i am dying to know when you can talk. sincerely, meg.ā€ ā€œhello jason. i have been with the company for one year and have taken on more responsibilities than outlined in my job description. i would appreciate an opportunity to speak with you about my position. let me know when we can schedule a meeting. you, meg.ā€ ā€œgreetings jason! i hope this e-mail finds you well and happy today. i really, really want to talk to you about something important. i am not sure if you have time. i hope you do. get back in touch with me and let me know when we might talk. ever so much for taking the time to read this. sincerely, meg.ā€
Answers: 3
Do you know the correct answer?
Create a new Java application called "WeightedAvgDataAnalyzer" (without the quotation marks), that m...

Questions in other subjects:

Konu
Mathematics, 11.02.2021 14:00
Konu
Mathematics, 11.02.2021 14:00
Konu
Mathematics, 11.02.2021 14:00
Konu
Mathematics, 11.02.2021 14:00