Create a program called calcweightedavgwithexceptions

Assignment Help JAVA Programming
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

Reference no: EM131596783

Questions Cloud

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

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd