Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named LongTaskthat extends the Threadclasscontaining the following:Private instance variablessharedData(of type SharedResults), inputData(of type StringBuffer)and target(of type char) Constructor thattakes three arguments and

Create a class named LongTaskthat extends the Threadclasscontaining the following:Private instance variablessharedData(of type SharedResults), inputData(of type StringBuffer)and target(of type char) Constructor thattakes three arguments and stores them in the instance variables.It should alsocreate a name for this thread as Thread_.In the run()method, use a loop overthe characters ininputDataand count the number of occurrences of target. After the loop is done, create a ResultsEntryobject with this count and the target character, and invoke the addToResults()methodof results

this is the code

public class LongTask extends Thread { //Create private instance variables SharedData, inputData, target private SharedResults sharedData; private StringBuffer inputData; private char target; //create constructor with three arguments public LongTask(SharedResults sharedData, StringBuffer inputData, char target) { this.sharedData = sharedData; this.inputData = inputData; this.target = target; //it should also create a name for this thread as Thread_; } //create run() method public void run() { /*Create for loop for looping over the characters in inputData and count the number of occurrences of target * * */ for (int i =1; i

} I stuck at the for loop I didn't know what to do and what is this it should also create a name for this thread as thread_

here I lost and I couldn't complete it?? any help??

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago