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

  Ask user to enter a list of names

Write a program that ask a user to enter a list of names. When you finish, The program will show the total number of characters in all the names.

  Design a java program that has two parallel arrays

Design a java program that has two parallel arrays: a string array named people that is initialized with the names of seven of your friends, and a string array named phoneNumbers that is initialized with your friends phone numbers.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Pass in the number of gallons on board

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Digital image processing using java

Digital image processing using java ..create plugin using Jedit and run it in imageJ

  Carl has implemented two programs

Carl picks 20 random names and finds that P1 sorts them faster than P2. "We're using P1!" exclaims Carl. Why are you hesitant to commit?

  Write a class that has three overloaded static methods

Write a class that has three overloaded static methods for calculating the areas of the following geometric shapes

  Consider the problem of finding the position

Consider the problem of finding the position, p, of the last occurrence of a given number, x, in an array, A. We thus want a function FindLast(A,n,x) with precondition

  Designing a program with a while loop

The section entitled "In the Spotlight", "Designing a program with a while loop" describes the requirements for a project at Chemical Labs, Inc. Write a letter to the Director of Engineering that describe your concerns, if any, regarding these re..

  1 explain the differences between our specifications of the

1. explain the differences between our specifications of the sorted list adt and the binary search tree adt.2. define a

  Inheritance involves the concept of super class

Inheritance involves the concept of super class (parent class) and sub class (derived class). What is a super class in Java? What is a sub or derived class in Java?

  Elliptic curve encryption

write a program to implement Elliptic Curve encryption/decryption and program will read parameters, plaintext and ciphertextfrom a file named "input.txt" (under the same directory).

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