Java program using the net beans ide

Assignment Help JAVA Programming
Reference no: EM13765501

For this Assignment, 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 threads and contains a method(threadedSort) that you will update to sort the data using threads.

Other Requirements: import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.ArrayList;

public class Sort {

* You are to implement this method. The method should invoke one or

* more threads to read and sort the data from the collection of Files.

* The method should return a sorted list of all of the String data

* contained in the files.

 

* @param files

* @return

* @throws IOException

public static String[] threadedSort(File[] files) throws IOException {

throw new java.lang.IllegalStateException("Method not implemented");

}

* Given an array of files, this method will return a sorted

* list of the String data contained in each of the files.

 

* @param files the files to be read

* @return the sorted data

* @throws IOException thrown if any errors occur reading the file

public static String[] sort(File[] files) throws IOException {

String[] sortedData = new String[0];

for (File file : files) {

String[] data = getData(file);

data = MergeSort.mergeSort(data);

sortedData = MergeSort.merge(sortedData, data);

}

return sortedData;

}

* This method will read in the string data from the specified

* file and return the data as an array of String objects.

* @param file the file containing the String data

* @return String array containing the String data

* @throws IOException thrown if any errors occur reading the file

*/

private static String[] getData(File file) throws IOException {

ArrayList<String> data = new ArrayList<String>();

BufferedReader in = new BufferedReader(new FileReader(file));

// Read the data from the file until the end of file is reached

while (true) {

String line = in.readLine();

if (line == null) {

// the end of file was reached

break;

}

else {

data.add(line);

}

}

//Close the input stream and return the data

in.close();

return data.toArray(new String[0]);

}

}

Reference no: EM13765501

Questions Cloud

Difference between proofreading and revision : Explain the difference between proofreading and revision
Observe the rule of the farm : Observe the rule of the farm. Abundance mentality versus scarcity mentality
Differential cash flows over the projects life : What is the projects initial outlay and what are the differential cash flows over the projects life.
Issue of dotcom.com : Discuss how you would begin redesigning dotcom.com's project management processes to minimize the problems it is experiencing with poor scope management.
Java program using the net beans ide : For this Assignment, 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.
Lasa i-tax seminar : You are the instructor of a one-day tax seminar to inform international students studying business in the United States about the current tax system.
Develop a lesson plan that incorporates udl : Develop a lesson plan that incorporates universal design for learning (UDL) and leverages educational technologies in the classroom.
What was harry''s mistake : When Harry took the plunge and went beyond the specific incident to talk about Craig's overall conduct, he made a mistake that is embodied in the statement "You always turn everything around so you come up clean. What was Harry's mistake
Unbiased reporting and independent assurance : In auditing, there is a real need for unbiased reporting and independent assurance. Give 2 examples of how an auditor could demonstrate compliance.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design and construct a computer program

Design and construct a computer program in one of the approved languages (C, C++, Java, Pascal, etc.) that will illustrate the use of a third-order explicit Runge-Kutta method of your own design.

  Implement a class called reversewords

Implement a class called ReverseWords that uses a stack to output a set of elements input by the user in reverse order.

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Write a program in java that simulates a simple line editor

Write a program in Java that simulates a simple line editor which supports the following operations

  Create a messageframe class extending jframe

Create a MessageFrame class extending JFrame and a MessagePanel class extending JPanel.

  Prepare a main method that tests all of your functions

A method that outputs the name and list of all patients - A method that resets the number of patients to 0 and the patientList to an empty list - Prepare a main method that tests (i.e, unit testing) all of your functions.

  Personalize the time zone application of section 24.3

Personalize the time zone application of Section 24.3. Prompt the user to log in and specify a city to be stored in a profile. The next time the user logs in, the time of their favorite city is displayed automatically.

  Demonstrate knowledge of design patterns

Your software should make use of the concepts outlined at the start of the assignment brief above. Think about where you can employ appropriate design patterns and other techniques.

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Alter the prototype form page by javascript function

Alter the prototype form page so that when JavaScript function has verified that all the required fields have been filled, cookie is added to user's computer.

  Hasanodddigit that returns whether any digit

d named hasAnOddDigit that returns whether any digit of a positive integer is odd. Your method should return true if the number has at least one odd digit and false if none of its digits are odd. 0, 2, 4, 6, and 8 are even digits, and 1, 3, 5, 7, 9 a..

  Determine the purpose of using javascriptr on a website

write a 200- to 300-word short-answer response to the followingwhat is the purpose of using javascriptr on a website?

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