Complete java program using netbeans

Assignment Help JAVA Programming
Reference no: EM131597930

Assignment

Create, using NetBeans, a complete Java program called CalcWeightedAvgDropLowest according to the following guidelines.
For this program, instead of getting the data from the user via System.in, get only input and output file names from the user. (See Horstmann, pp. 319, 320).
The input file - which you need to create and prompt the user for - should be called 'data.txt',and it 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. Also, include a method called printResults that prompts the user for the name of an output file and then prints the results to that user-designated output file.
Your main program should contain just three lines like these:
ArrayList<Double> inputValues = getData();
double weightedAvg = calcWeightedAvg(inputValues);
printResults(inputValues, weightedAvg);
The inputValues come from a single line in your "data.txt" file such as the following:
0.5 3 10 70 90 80 20
The output file should contain something 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."
Creating the Input file
To create the input file, while in NetBeans with your project open, click to highlight the name of the project in the Projects tab at the upper left part of the IDE. That tab should be called CalcWeightedAvgDropLowest. 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
In the empty file data.txt that you just created, add a single line of data like 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. Also, instead of displaying the output to the console, let the user choose a file name (as in Horstmann's example), and write the output to a file with that user-supplied name (e.g., output.txt).
Thoughts
It's important that your input file is where NetBeans will look to find it. The above instructions should make sure that that happens.
Make sure you prompt the user for the name of the input file. You can use a prompt like: "Enter "data.txt" (no quotes) for the name of the input file: "
Note that if you run this program from the command line, the input file should be in the same directory as your .class file.

Reference no: EM131597930

Questions Cloud

Re-write the words of the sentence in the correct order : Why did the basketball player bring a suitcase with him to a ball game? Just in case he travels! The words in the sentences have been scrambled. On the lines provided below each sentence, re-write the words of the sentence in the correct order. 1. c..
How you use vroom-yetton model to improve decision making : What was your role? How were you involved? How would you use the Vroom-Yetton Model to improve the decision making process in your workplace?
Write a function to generate a schedule : Design a Medication class which includes when to begin taking the medication, when to end, proper dosage, and frequency
How long will it take to pay off the mortgage : how long will it take to pay off the mortgage if the EAR of the loan is? unchanged?
Complete java program using netbeans : Create, using NetBeans, a complete Java program called CalcWeightedAvgDropLowest according to the guidelines - the input file should be in the same directory
Which do you believe presents the greatest threat to civil : Which do you believe presents the greatest threat to civil society: a corporation that commits crimes (e.g., murder, environmental crimes, or bribery).
How much would the npv change if discount rate increases : The discount rate that your firm uses for projects of this type is 12%. How much would the NPV change if discount rate increases to 8%?
Design processes to manage employee performance : Propose three (3) ways that a manager can cope with any negative emotions that may accompany an employee layoff.
Create a gui program that displays the text : Create a GUI program that displays the text "Hello." Create a dropdown list to select the language the text is displayed in. Use English, German, French

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a game of tic-tac-toe

Specify, design, and implement a class that can be one player in a Game of tic-tac-toe. The constructor should be specify whether the object is to be the first player (X's) or the second player (O's).

  Analyze a familys spending habits

Analyze a familys spending habits by creating a program that performs arithmetic calculations - should accept decimal values from the user

  Write a class that reads a file

In java, write a class that reads a file and outputs a list of the unique words in the file and the number of times each unique word occurs.Hint: use a HashMap with keys being the words and values being integer counts associated with the words.

  What are the advantages and disadvantages of java

What are the advantages and disadvantages of Java as compared to the other two - What are the expectation in the journey between those two positions

  Create a software artifact by applying the methodologies

Create a software artifact by applying the methodologies of advanced object- oriented programming to a requirements speciation. Select and apply a design pattern from one of the major design patterns to solve a given problem.

  Various ways of exception handling

Various ways of exception handling

  Find how many strings in a have exactly three 5s

Let A be the set of all strings of decimal digits of length five. For example, 00312, 99999, and 19483 are strings in A.

  Calculate and report the statistics

Create a sub-method to display all grades in the grade book passed into the method as a parameter - calculate and report the statistics

  Implement a fastdefaultlist class that represent

Implement a FastDefaultList class that represents an infinite list with indices 0,1,2,3,...,∞ When we start, every value in this list is assigned the default value null.

  Determine how you will fix each type of error

Determine how you will fix each type of error. Be sure to clearly highlight the five steps within your posting - Using your text and/or the Internet as a resour

  Create a controller class that implements an fcfs schedule

Create a controller class that implements an FCFS schedule and instantiates 5 objects of each class and runs each object - write to the system out a number of times.

  Update an existing java program using the netbeans ide

you will update an existing Java program using the NetBeans IDE. You will use the NetBeans Integrated Development Environment to make changes to an existing NetBeans Java Project. This existing program correctly sorts the data without using thread..

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