*USE JAVA
In this project you will create program that calculate the number of times every word appears in a given text file. Your program will take in the name of the file as well as the number of threads to create to speed up the process. The numbers of threads must be greater than 0. The output will be saved into a file in alphabetical order.
Besides creating the program itself, you are to run experiments to show how the use of threads can help or hurt your programs efficiency. This means you will produce a report (around a page) detailing your algorithm, your experiment, and the data you collected. Be sure to include at least one graph of your runtime based on different thread counts.
As you did in the previous homework, please submit your code, your report, and a Readme to allow me to run your project as well as replicate your experiments.
*USE JAVA
Hi,
As per the problem statement, In order to find the number of times every word appears in the text file, I'm using multi threaded envirnoment to solve this .
As you mentioned in the second problem statement, if file size was bug enough to handle in such case multi threaded race condition will . works fine with provided code and works efficiently.
Please find the pseudo code below:
|
public class WrodCountImpl { public static void main(String args[]) { for (String filename : args) { Runnable tester = new WordCount(filename); Thread t = new Thread(tester); t.start(); } } } public class WordCount implements Runnable { public WordCount(String filename) { this.filename = filename; } public void run() { String wordname = scan.nextLine(); int count = 0; try (LineNumberReader r = new LineNumberReader(new FileReader(filename))) { String line; while ((line = r.readLine()) != null) { for (String element : line.split(" ")) { if (element.equalsIgnoreCase(wordname)) { count++; System.out.println("Word found at line " + r.getLineNumber()); } } } } System.out.println("The word " + wordname + " appears " + count + " times."); } private String filename; } |
As question was lengthy , i answered the business logic.
Please reach me out , if any doubts
*USE JAVA In this project you will create program that calculate the number of times every...
JAVA Program!
Write a program that makes use of threading. You will have one thread count how many times a second has passed and the second thread will count how many times 3 seconds has passed This will occur in an infinite loop and the counts will be printed to the screen. Indent the count of one of the threads for easier viewing
Write a program that makes use of threading. You will have one thread count how many times...
Description: Overview: You will write a program (says wordcountfreq.c) to find out the number of words and how many times each word appears (i.e., the frequency) in multiple text files. Specifically, the program will first determine the number of files to be processed. Then, the program will createmultiple threads where each thread is responsible for one file to count the number of words appeared in the file and report the number of time each word appears in a global linked-list....
Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....
Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...
For the following multithreaded program, use system level scope for thread scheduling. Submit your program and screenshot of output in a single word/pdf file. Write a multithreaded program (USING C PROGRAM) that calculates various statistical values for a list of numbers. This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the...
kindly make a java threaded program main class will accept n number and produce user inputed array of n elements make 3 child threads(class) out of one main thread(class) must use thread.sleep and thread synchronization one thread create max of array elements one will min of array elements one will provide average of array elements then display of array will occur
JAVA program For this project you are to create an array of objects of your choice using java your Driver Class, Object Classes should all be named appropriately depending on what Classes and Objects you decide to create for this assignment. This project must give the user the ability to view and to change the elements of the array. Print your results (output) as a clear and informative statement. Your output should also include an explanation of what your program...
Description In this homework, you are asked to implement a multithreaded program that will allow us to measure the performance (i.e, CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJE PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I'O burst time(ms) will be given in an input file. Assume that all scheduling algorithms except RR will be non-preemptive,...
Understand the Application For this lab you will create a basic application programming interface (API) for spawning multiple threads in a program using Python3's threading module. The Program Spec Write a program that creates a minimum of two threads with different target functions. Each thread will perform the work of each function. Each function will compute a task (described below) and print out a result. Implementation Details Write a program that creates a minimum of two threads using Python's threading...
Create a New Java Project called YourLastNameUpperCase. Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file should be opened for writing. The program should read the contents of the first file, change all characters to uppercase, and store the results in the second file. The second file will be a copy of the first file, except that all the characters will be uppercase. Use...