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

  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