Reference no: EM131596783
Assignment
Create a program called CalcWeightedAvgWithExceptions2 by modifying Horstmann's program DataAnalyzer.java (Section 7.5, pp. 350-351, and also in this module), according to the specifications below. The input file should be called 'data.txt' and should be created according to the highlighted instructions below.
The input file should contain (in order): the weight, the number, n, of lowest numbers to drop, and the numbers to be averaged after dropping the lowest n values. See the example below.
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. You need not, but you may, also allow the user to reenter an output file name if exceptions in opening the output file are caught.
1. Modify the structure of the main method in Horstmann's DataAnalyzer.java so that, in addition to prompting the user to enter 'data.txt' as the name of the input file, you call a method to calculate the weighted average prompt the user for the name of an output file, and then call a method to print the results to the output file.
2. Your methods should handle exceptions in trying to read the input file in a way similar to the way Horstmann handles them in DataAnalyzer.java. Your method for calculating the weighted average need not handle any exceptions (though it may), and how your method for printing the results handles exceptions is up to you.
3. The main focus is to give your program the ability to re-enter the input file name if the specified exceptions are caught.
Creating the Input File
To create the input file, while in NetBeans with your project open, click to highlight the top-level folder of your project, which should be called CalcWeightedAvgWithExceptions. Then:
File-→New File...
Keep the Project name at the top; keep Filter blank
Categories → Other (at the bottom of the categories list)
File Types → 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
What principles did you identify
: What principles did you identify that are new to you but could be important in improving your collection of clinical data?
|
What is currently required of public sector organizations
: What is currently required of public sector organizations either at federal level, or in your particular state or city, in terms of Affirmative Action policies?
|
How much gain or loss is recognized
: How much gain or loss is recognized and what is his basis in the capital asset received in distribution
|
Which method do you think would work best to obtain info
: Which method do you think would work best to obtain this information: a questionnaire, a face-to-face interview, or a group interview?
|
Create a program called calcweightedavgwithexceptions
: Create a program called CalcWeightedAvgWithExceptions2 by modifying Horstmann's program DataAnalyzer
|
What is the dollar amount of the premium or discount
: The bonds pay interest semi-annually each June 30 and December 31. What is the dollar amount of the premium or discount
|
Discuss about logical entity relationship diagram
: Milestone 3.1 (Data Model Diagrams - for database requirements - Week 5 Lecture)
|
How do we balance the four goals
: How do we balance the four goals? If we use bureaucratic systems to serve all clients coming to us for service in exactly the same way.
|
What is dollar amount of amortization for june
: On December 31, 2016, Happy Corporation issued $560,000, 14%, What is dollar amount of amortization for June 30, 2017
|