Individual Assignment 1

Due 3/26, 11:59 p.m.

 

The goal of this assignment is to use java threads, explained in chapter 4 of your textbook.

Write a java program, creating three threads, to sort two arrays and merge them into a third array. More specifically:

  1. Create a thread to sort the first array.
  2. Create a thread to sort the second array.
  3. Create a thread to merge the arrays into the third array.
  4. Let the main method prints the merged array.

 

You must call the two sorter threads together. In other words, if we name these threads sorta, sortb, and merge, you must call the start methods in the following sequence:

 

      sorta.start();

      sortb.start();

     

Some java code

 

merge.start();

 

I post the sequential program for this assignment. Note that you need to change the classes Sorter and Merger to make them suitable for threads.