*with psuedo code First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "WeightedAvgDataAnalyzer" (without the quotation marks), that does the following: This program is similar to the previous assignment - "WeightedAvgDropSmallest" - with a major difference that the inputs for the program will be read from a file and the output for this assignment should be written to a new file.  The concept of application is as follows: The program will read numbers from a file -  data.txt - that you will create, 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. Example data.txt file would display: 0.5 3 10 70 90 80 20 The program then calculates the weighted average of all those numbers except the lowest n numbers, where n and the weight are also given by the user. The program will output the results of this calculation to a new file - results.txt that contains the following each on its own line: the original numbers, the weight, the number of lowest numbers dropped, and the calculated average: Original Numbers: 10 70 90 80 20 Weight: 0.5 Numbers to Drop: 3 Weighted Average: 42.5 Methods The program uses methods to: Read the input file, 'data.txt' that should be created according to the highlighted instructions above: This method should take a single argument (the file name ) and return an array list of doubles. Get the number of lowest numbers to drop before calculating the average This method should take the array list of doubles generated from method #1 and return a single integer Get the weight to be used in the weighted average calculation This method should take the array list of doubles generated from method #1 and return a single double Get the lowest N This method should take the array list of doubles generated from method #1 and the lowest N integer generated from method 2.  This method will return a new array list of doubles of only the items that need to be calculated for the weighted average.  For example: passing in 10, 30, 50, 60, 20, 100, and a lowest N of 2, should return an array list of 30, 50, 60, 100.  Calculate the weighted average of the numbers This method should take two arguments: an array list of numbers (the return value of method #4 above) and a double (the weight). This method should return a double (the weighted average of the provided numbers). Print the results to a new file - results.txt This method should take four arguments: an array list of numbers (the return value of the first method above); an integer (the number of smallest numbers to drop before calculating the average); a double (the weight); and a double (the weighted average returned from the fourth method above). This method should have no return value. Additional Notes For full credit your methods for getting data and printing results should each throw a FileNotFoundException. Extra Credit Opportunity Have the file names of the input and output be user defined by a prompt.  The input prompt should loop until the user enters a valid filename.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

*with psuedo code

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).

Then create a new Java application called "WeightedAvgDataAnalyzer" (without the quotation marks), that does the following:

This program is similar to the previous assignment - "WeightedAvgDropSmallest" - with a major difference that the inputs for the program will be read from a file and the output for this assignment should be written to a new file.  The concept of application is as follows:

The program will read numbers from a file -  data.txt - that you will create, 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. Example data.txt file would display:

0.5 3 10 70 90 80 20

The program then calculates the weighted average of all those numbers except the lowest n numbers, where n and the weight are also given by the user. The program will output the results of this calculation to a new file - results.txt that contains the following each on its own line: the original numbers, the weight, the number of lowest numbers dropped, and the calculated average:

Original Numbers: 10 70 90 80 20
Weight: 0.5
Numbers to Drop: 3
Weighted Average: 42.5

Methods

The program uses methods to:

  1. Read the input file, 'data.txt' that should be created according to the highlighted instructions above:
    • This method should take a single argument (the file name ) and return an array list of doubles.

  2. Get the number of lowest numbers to drop before calculating the average
    • This method should take the array list of doubles generated from method #1 and return a single integer

  3. Get the weight to be used in the weighted average calculation
    • This method should take the array list of doubles generated from method #1 and return a single double

  4. Get the lowest N
    • This method should take the array list of doubles generated from method #1 and the lowest N integer generated from method 2.  This method will return a new array list of doubles of only the items that need to be calculated for the weighted average. 
    • For example: passing in 10, 30, 50, 60, 20, 100, and a lowest N of 2, should return an array list of 30, 50, 60, 100. 

  5. Calculate the weighted average of the numbers
    • This method should take two arguments: an array list of numbers (the return value of method #4 above) and a double (the weight). This method should return a double (the weighted average of the provided numbers).

  6. Print the results to a new file - results.txt
    • This method should take four arguments: an array list of numbers (the return value of the first method above); an integer (the number of smallest numbers to drop before calculating the average); a double (the weight); and a double (the weighted average returned from the fourth method above). This method should have no return value.

Additional Notes

  • For full credit your methods for getting data and printing results should each throw a FileNotFoundException.

Extra Credit Opportunity

  • Have the file names of the input and output be user defined by a prompt.  The input prompt should loop until the user enters a valid filename. 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY